Skip to content

Commit

Permalink
Edit Post: Remove user pattern preloading (#64459)
Browse files Browse the repository at this point in the history
* Edit Post: Remove user pattern preloading
* Update backport changelog

Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored Aug 13, 2024
1 parent 9ca5628 commit 02d0520
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions backport-changelog/6.7/7179.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
https://github.com/WordPress/wordpress-develop/pull/7179

* https://github.com/WordPress/gutenberg/pull/64401
* https://github.com/WordPress/gutenberg/pull/64459
18 changes: 18 additions & 0 deletions lib/compat/wordpress-6.7/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,24 @@ function gutenberg_block_editor_preload_paths_6_7( $paths, $context ) {
}
}

if ( 'core/edit-post' === $context->name ) {
$reusable_blocks_key = array_search(
add_query_arg(
array(
'context' => 'edit',
'per_page' => -1,
),
rest_get_route_for_post_type_items( 'wp_block' )
),
$paths,
true
);

if ( false !== $parts_key ) {
unset( $paths[ $reusable_blocks_key ] );
}
}

return $paths;
}
add_filter( 'block_editor_rest_api_preload_paths', 'gutenberg_block_editor_preload_paths_6_7', 10, 2 );
Expand Down

0 comments on commit 02d0520

Please sign in to comment.