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 and pull[bot] committed Aug 15, 2024
1 parent 192013d commit 5129775
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 5129775

Please sign in to comment.