Skip to content

Commit

Permalink
Site Editor: Add 'OPTIONS /page' to preloaded paths (WordPress#64890)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>
  • Loading branch information
3 people authored and bph committed Aug 31, 2024
1 parent e813eb2 commit f64ee62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backport-changelog/6.7/7270.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/7270

* https://github.com/WordPress/gutenberg/pull/64890
6 changes: 6 additions & 0 deletions lib/compat/wordpress-6.7/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ function gutenberg_block_editor_preload_paths_6_7( $paths, $context ) {
if ( false !== $parts_key ) {
$paths[ $parts_key ] = '/wp/v2/types/wp_template_part?context=edit';
}

$page_options_path = array( rest_get_route_for_post_type_items( 'page' ), 'OPTIONS' );
$page_options_key = array_search( $page_options_path, $paths, true );
if ( false === $page_options_key ) {
$paths[] = $page_options_path;
}
}

if ( 'core/edit-post' === $context->name ) {
Expand Down

0 comments on commit f64ee62

Please sign in to comment.