Changeset 59958 for trunk/src/wp-admin/site-editor.php
- Timestamp:
- 03/10/2025 10:32:56 AM (18 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/site-editor.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/site-editor.php
r59850 r59958 140 140 } 141 141 142 $block_editor_context = new WP_Block_Editor_Context( array( 'name' => 'core/edit-site' ) ); 142 $context_settings = array( 'name' => 'core/edit-site' ); 143 144 if ( ! empty( $_GET['postId'] ) && is_numeric( $_GET['postId'] ) ) { 145 $context_settings['post'] = get_post( (int) $_GET['postId'] ); 146 } elseif ( isset( $_GET['p'] ) && preg_match( '/^\/page\/(\d+)$/', $_GET['p'], $matches ) ) { 147 $context_settings['post'] = get_post( (int) $matches[1] ); 148 } 149 150 $block_editor_context = new WP_Block_Editor_Context( $context_settings ); 143 151 $custom_settings = array( 144 152 'siteUrl' => site_url(), … … 200 208 'GET', 201 209 ), 202 ); 210 '/wp/v2/settings', 211 array( '/wp/v2/settings', 'OPTIONS' ), 212 // Used by getBlockPatternCategories in useBlockEditorSettings. 213 '/wp/v2/block-patterns/categories', 214 // @see packages/core-data/src/entities.js 215 '/?_fields=' . implode( 216 ',', 217 array( 218 'description', 219 'gmt_offset', 220 'home', 221 'name', 222 'site_icon', 223 'site_icon_url', 224 'site_logo', 225 'timezone_string', 226 'url', 227 'page_for_posts', 228 'page_on_front', 229 'show_on_front', 230 ) 231 ), 232 ); 233 234 if ( $block_editor_context->post ) { 235 $route_for_post = rest_get_route_for_post( $block_editor_context->post ); 236 if ( $route_for_post ) { 237 $preload_paths[] = add_query_arg( 'context', 'edit', $route_for_post ); 238 if ( 'page' === $block_editor_context->post->post_type ) { 239 $preload_paths[] = add_query_arg( 240 'slug', 241 // @see https://github.com/WordPress/gutenberg/blob/e093fefd041eb6cc4a4e7f67b92ab54fd75c8858/packages/core-data/src/private-selectors.ts#L244-L254 242 empty( $block_editor_context->post->post_name ) ? 'page' : 'page-' . $post->post_name, 243 '/wp/v2/templates/lookup' 244 ); 245 } 246 } 247 } else { 248 $preload_paths[] = '/wp/v2/templates/lookup?slug=front-page'; 249 $preload_paths[] = '/wp/v2/templates/lookup?slug=home'; 250 } 203 251 204 252 block_editor_rest_api_preload( $preload_paths, $block_editor_context );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)