HTTP/2 200
server: nginx
date: Fri, 18 Jul 2025 18:55:25 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-olaf: ⛄
link:
; rel="https://api.w.org/"
link:
; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
x-frame-options: SAMEORIGIN
content-encoding: gzip
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 1
WP_REST_Posts_Controller::__construct() – Method | Developer.WordPress.org
WordPress Developer Resources
WP_REST_Posts_Controller::__construct()
WP_REST_Posts_Controller::__construct( string $post_type )
$post_type
stringrequiredPost type.
public function __construct( $post_type ) {
$this->post_type = $post_type;
$obj = get_post_type_object( $post_type );
$this->rest_base = ! empty( $obj->rest_base ) ? $obj->rest_base : $obj->name;
$this->namespace = ! empty( $obj->rest_namespace ) ? $obj->rest_namespace : 'wp/v2';
$this->meta = new WP_REST_Post_Meta_Fields( $this->post_type );
}
View all references View on Trac View on GitHub
Version | Description |
---|
4.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.