mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 12:58:25 +01:00
Editor: Ensure only the main query is modified when resolving template for new posts.
This adds a check for the main query in `_resolve_template_for_new_post()` to fix a 404 response when resolving template for new posts or pages caused by the wrong query being modified. Original PR from Gutenberg repository: * [https://github.com/WordPress/gutenberg/pull/40799 #40799: Ensure only the main query is modified when resolving template for new posts] Follow-up to [52316]. Props petitphp, zieladam, poena, ndiego, gziolo, kebbet, Mamaduka, manfcarlo. See #56058. git-svn-id: https://develop.svn.wordpress.org/trunk@53593 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d45bfba3bc
commit
28720264d8
@ -312,6 +312,10 @@ function _block_template_render_without_post_block_context( $context ) {
|
||||
* @param WP_Query $wp_query Current WP_Query instance, passed by reference.
|
||||
*/
|
||||
function _resolve_template_for_new_post( $wp_query ) {
|
||||
if ( ! $wp_query->is_main_query() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
remove_filter( 'pre_get_posts', '_resolve_template_for_new_post' );
|
||||
|
||||
// Pages.
|
||||
|
Loading…
x
Reference in New Issue
Block a user