mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
REST API: Replace hardcoded wp/v2/
preloaded paths with rest_get_route_for_taxonomy_items()
and rest_get_route_for_post_type_items()
in wp-admin/site-editor.php
.
[51962] and [51964] introduced two new functions: `rest_get_route_for_post_type_items()` and `rest_get_route_for_taxonomy_items()`. These functions replaced hardcoded references in all parts of core that reference taxonomy and post type rest controller endpoints. However, several instances were missed in the `wp-admin/site-editor.php` file. This commit replaces those remaining hardcoded instances. Follow-up to [51962], [51964], [52232]. Props spacedmonkey. Fixes #54536. Built from https://develop.svn.wordpress.org/trunk@52281 git-svn-id: http://core.svn.wordpress.org/trunk@51873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4212bcfe36
commit
14f6cf230b
@ -64,7 +64,7 @@ if ( isset( $_GET['postType'] ) && ! isset( $_GET['postId'] ) ) {
|
|||||||
'/',
|
'/',
|
||||||
'/wp/v2/types/' . $post_type->name . '?context=edit',
|
'/wp/v2/types/' . $post_type->name . '?context=edit',
|
||||||
'/wp/v2/types?context=edit',
|
'/wp/v2/types?context=edit',
|
||||||
'/wp/v2/' . $post_type->rest_base . '?context=edit',
|
add_query_arg( 'context', 'edit', rest_get_route_for_post_type_items( $post_type ) ),
|
||||||
);
|
);
|
||||||
|
|
||||||
block_editor_rest_api_preload( $preload_paths, $block_editor_context );
|
block_editor_rest_api_preload( $preload_paths, $block_editor_context );
|
||||||
@ -88,16 +88,16 @@ if ( isset( $_GET['postType'] ) && ! isset( $_GET['postId'] ) ) {
|
|||||||
$active_global_styles_id = WP_Theme_JSON_Resolver::get_user_custom_post_type_id();
|
$active_global_styles_id = WP_Theme_JSON_Resolver::get_user_custom_post_type_id();
|
||||||
$active_theme = wp_get_theme()->get_stylesheet();
|
$active_theme = wp_get_theme()->get_stylesheet();
|
||||||
$preload_paths = array(
|
$preload_paths = array(
|
||||||
array( '/wp/v2/media', 'OPTIONS' ),
|
array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ),
|
||||||
'/',
|
'/',
|
||||||
'/wp/v2/types?context=edit',
|
'/wp/v2/types?context=edit',
|
||||||
'/wp/v2/taxonomies?context=edit',
|
'/wp/v2/taxonomies?context=edit',
|
||||||
'/wp/v2/pages?context=edit',
|
add_query_arg( 'context', 'edit', rest_get_route_for_post_type_items( 'page' ) ),
|
||||||
'/wp/v2/categories?context=edit',
|
add_query_arg( 'context', 'edit', rest_get_route_for_post_type_items( 'post' ) ),
|
||||||
'/wp/v2/posts?context=edit',
|
add_query_arg( 'context', 'edit', rest_get_route_for_taxonomy_items( 'category' ) ),
|
||||||
'/wp/v2/tags?context=edit',
|
add_query_arg( 'context', 'edit', rest_get_route_for_taxonomy_items( 'post_tag' ) ),
|
||||||
'/wp/v2/templates?context=edit',
|
add_query_arg( 'context', 'edit', rest_get_route_for_post_type_items( 'wp_template' ) ),
|
||||||
'/wp/v2/template-parts?context=edit',
|
add_query_arg( 'context', 'edit', rest_get_route_for_post_type_items( 'wp_template_part' ) ),
|
||||||
'/wp/v2/settings',
|
'/wp/v2/settings',
|
||||||
'/wp/v2/themes?context=edit&status=active',
|
'/wp/v2/themes?context=edit&status=active',
|
||||||
'/wp/v2/global-styles/' . $active_global_styles_id . '?context=edit',
|
'/wp/v2/global-styles/' . $active_global_styles_id . '?context=edit',
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.9-alpha-52280';
|
$wp_version = '5.9-alpha-52281';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user