- Timestamp:
- 11/08/2016 01:08:49 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
r39046 r39161 582 582 583 583 /** 584 * Retrieves post data given a post ID or post object.585 *586 * This is a subset of the functionality of the `get_post()` function, with587 * the additional functionality of having `the_post` action done on the588 * resultant post object. This is done so that plugins may manipulate the589 * post that is used in the REST API.590 *591 * @since 4.7.0592 * @access public593 *594 * @see get_post()595 * @global WP_Query $wp_query596 *597 * @param int|WP_Post $post Post ID or object. Defaults to global `$post` object.598 * @return WP_Post|null A WP_Post object when successful, otherwise null.599 */600 public function get_post( $post ) {601 $post_obj = get_post( $post );602 603 /**604 * Filters the post in the context of a REST request.605 *606 * Allows plugins to filter the post object as returned by WP_REST_Controller::get_post().607 *608 * @since 4.7.0609 *610 * @param WP_Post|null $post_obj The post object as returned by get_post().611 * @param int|WP_Post $post The original value used to obtain the post object.612 */613 $post = apply_filters( 'rest_the_post', $post_obj, $post );614 615 return $post;616 }617 618 /**619 584 * Sanitizes the slug value. 620 585 *
Note: See TracChangeset
for help on using the changeset viewer.