| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
REST API: WP_REST_Revisions_Controller class
| File Size: | 989 lines (31 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
WP_REST_Revisions_Controller:: (17 methods):
__construct()
register_routes()
get_parent()
get_items_permissions_check()
get_revision()
get_items()
get_item_permissions_check()
get_item()
delete_item_permissions_check()
delete_item()
prepare_items_query()
prepare_item_for_response()
restore_post_data()
prepare_date_response()
get_item_schema()
get_collection_params()
prepare_excerpt_response()
Class: WP_REST_Revisions_Controller - X-Ref
Core class used to access revisions via the REST API.| __construct( $parent_post_type ) X-Ref |
| Constructor. param: string $parent_post_type Post type of the parent. |
| register_routes() X-Ref |
| Registers the routes for revisions based on post types supporting revisions. |
| get_parent( $parent_post_id ) X-Ref |
| Get the parent post, if the ID is valid. param: int $parent_post_id Supplied ID. return: WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise. |
| get_items_permissions_check( $request ) X-Ref |
| Checks if a given request has access to get revisions. param: WP_REST_Request $request Full details about the request. return: true|WP_Error True if the request has read access, WP_Error object otherwise. |
| get_revision( $id ) X-Ref |
| Get the revision, if the ID is valid. param: int $id Supplied ID. return: WP_Post|WP_Error Revision post object if ID is valid, WP_Error otherwise. |
| get_items( $request ) X-Ref |
| Gets a collection of revisions. param: WP_REST_Request $request Full details about the request. return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| get_item_permissions_check( $request ) X-Ref |
| Checks if a given request has access to get a specific revision. param: WP_REST_Request $request Full details about the request. return: true|WP_Error True if the request has read access for the item, WP_Error object otherwise. |
| get_item( $request ) X-Ref |
| Retrieves one revision from the collection. param: WP_REST_Request $request Full details about the request. return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| delete_item_permissions_check( $request ) X-Ref |
| Checks if a given request has access to delete a revision. param: WP_REST_Request $request Full details about the request. return: true|WP_Error True if the request has access to delete the item, WP_Error object otherwise. |
| delete_item( $request ) X-Ref |
| Deletes a single revision. param: WP_REST_Request $request Full details about the request. return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| prepare_items_query( $prepared_args = array() X-Ref |
| Determines the allowed query_vars for a get_items() response and prepares them for WP_Query. param: array $prepared_args Optional. Prepared WP_Query arguments. Default empty array. param: WP_REST_Request $request Optional. Full details about the request. return: array Items query arguments. |
| prepare_item_for_response( $item, $request ) X-Ref |
| Prepares the revision for the REST response. param: WP_Post $item Post revision object. param: WP_REST_Request $request Request object. return: WP_REST_Response Response object. |
| restore_post_data( ?WP_Post $previous_post ) X-Ref |
| Restores the global post to its previous value after preparing a revision. Preparing a revision overwrites the global post and post data via setup_postdata(). This restores the global post that was in place beforehand so the change does not leak into the rest of the request. Only the global post is guaranteed to be restored. When there was no previous global post and the main query has no post either, which is the usual state during a REST request, wp_reset_postdata() has nothing to restore from, so the remaining globals set by setup_postdata() (such as $id, $authordata and $pages) are left describing the revision. Clearing those would mean unsetting each one by hand, which is beyond what is needed to keep the global post from leaking. param: WP_Post|null $previous_post The global post to restore, or null if there was none. |
| prepare_date_response( $date_gmt, $date = null ) X-Ref |
| Checks the post_date_gmt or modified_gmt and prepare any post or modified date for single post output. param: string $date_gmt GMT publication time. param: string|null $date Optional. Local publication time. Default null. return: string|null ISO8601/RFC3339 formatted datetime, otherwise null. |
| get_item_schema() X-Ref |
| Retrieves the revision's schema, conforming to JSON Schema. return: array Item schema data. |
| get_collection_params() X-Ref |
| Retrieves the query params for collections. return: array Collection parameters. |
| prepare_excerpt_response( $excerpt, $post ) X-Ref |
| Checks the post excerpt and prepare it for single post output. param: string $excerpt The post excerpt. param: WP_Post $post Post revision object. return: string Prepared excerpt or empty string. |
| Generated : Tue Aug 18 08:20:25 2026 | Cross-referenced by PHPXref |