Make WordPress Core

Changeset 53594 for branches/6.0


Ignore:
Timestamp:
06/30/2022 03:48:22 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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:

Follow-up to [52316].

Props petitphp, zieladam, poena, ndiego, gziolo, kebbet, Mamaduka, manfcarlo.
Merges [53593] to the 6.0 branch.
See #56058.

Location:
branches/6.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.0

  • branches/6.0/src/wp-includes/block-template.php

    r53093 r53594  
    313313 */
    314314function _resolve_template_for_new_post( $wp_query ) {
     315        if ( ! $wp_query->is_main_query() ) {
     316                return;
     317        }
     318
    315319        remove_filter( 'pre_get_posts', '_resolve_template_for_new_post' );
    316320
Note: See TracChangeset for help on using the changeset viewer.