WP_REST_Global_Styles_Controller::get_post() – Get the post, if the ID is valid.
You appear to be a bot. Output may be restricted
Description
Get the post, if the ID is valid.
Usage
$WP_Post|WP_Error = WP_REST_Global_Styles_Controller::get_post( $id );
Parameters
- $id
- ( int ) required – Supplied ID.
Returns
WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise.
Source
File name: wordpress/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
Lines:
1 to 19 of 19
protected function get_post( $id ) { $error = new WP_Error( 'rest_global_styles_not_found', __( 'No global styles config exist with that id.' ), array( 'status' => 404 ) ); $id = (int) $id; if ( $id <= 0 ) { return $error; } $post = get_post( $id ); if ( empty( $post ) || empty( $post->ID ) || $this->post_type !== $post->post_type ) { return $error; } return $post; }