mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-20 19:56:49 +01:00
REST API: Improve autosave and revision endpoints for templates and template parts.
Fixes those endpoints for file-based templates and template parts, as templates based on theme files can't be revisioned or autosaved. Props antonvlasenko, swissspidy, spacedmonkey, kadamwhite. Fixes #61970. Built from https://develop.svn.wordpress.org/trunk@59605 git-svn-id: http://core.svn.wordpress.org/trunk@58990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5372b3ffa2
commit
7dcc7f8d32
|
|
@ -170,7 +170,17 @@ class WP_REST_Template_Revisions_Controller extends WP_REST_Revisions_Controller
|
|||
return new WP_Error(
|
||||
'rest_post_invalid_parent',
|
||||
__( 'Invalid template parent ID.' ),
|
||||
array( 'status' => 404 )
|
||||
array( 'status' => WP_Http::NOT_FOUND )
|
||||
);
|
||||
}
|
||||
|
||||
$parent_post_id = isset( $template->wp_id ) ? (int) $template->wp_id : 0;
|
||||
|
||||
if ( $parent_post_id <= 0 ) {
|
||||
return new WP_Error(
|
||||
'rest_invalid_template',
|
||||
__( 'Templates based on theme files can\'t have revisions.' ),
|
||||
array( 'status' => WP_Http::BAD_REQUEST )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.8-alpha-59604';
|
||||
$wp_version = '6.8-alpha-59605';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user