Skip to content

Commit a34e00b

Browse files
petitphpadamziel
authored andcommitted
#40675: Ensure only the main query is modified when resolving template for new posts. (#40799)
1 parent 4970dcf commit a34e00b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/compat/wordpress-5.9/block-template.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ function gutenberg_template_render_without_post_block_context( $context ) {
286286
* @return void
287287
*/
288288
function gutenberg_resolve_template_for_new_post( $wp_query ) {
289+
if ( ! $wp_query->is_main_query() ) {
290+
return;
291+
}
289292
remove_filter( 'pre_get_posts', 'gutenberg_resolve_template_for_new_post' );
290293

291294
// Pages.

0 commit comments

Comments
 (0)