Make WordPress Core


Ignore:
Timestamp:
08/23/2022 03:52:08 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Editor: Backport bug fixes from Gutenberg into Core for WP 6.0.2 RC.

This brings a new version of the Gutenberg code from the wp/6.0 branch into core.

  • @wordpress/block-directory@3.4.14
  • @wordpress/block-editor@8.5.10
  • @wordpress/block-library@7.3.14
  • @wordpress/customize-widgets@3.3.14
  • @wordpress/edit-post@6.3.14
  • @wordpress/edit-site@4.3.14
  • @wordpress/edit-widgets@4.3.14
  • @wordpress/editor@12.5.10
  • @wordpress/format-library@3.4.10
  • @wordpress/reusable-blocks@3.4.10
  • @wordpress/widgets@2.4.10

Props gziolo, SergeyBiryukov.
Merges [53929] to the 6.0 branch.
Fixes #56414.

Location:
branches/6.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.0

  • branches/6.0/src/wp-includes/blocks/post-template.php

    r53645 r53930  
    4545        $page     = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];
    4646
    47         $query_args = build_query_vars_from_query_block( $block, $page );
    48         // Override the custom query with the global query if needed.
     47        // Use global query if needed.
    4948        $use_global_query = ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] );
    5049        if ( $use_global_query ) {
    5150                global $wp_query;
    52                 if ( $wp_query && isset( $wp_query->query_vars ) && is_array( $wp_query->query_vars ) ) {
    53                         // Unset `offset` because if is set, $wp_query overrides/ignores the paged parameter and breaks pagination.
    54                         unset( $query_args['offset'] );
    55                         $query_args = wp_parse_args( $wp_query->query_vars, $query_args );
    56 
    57                         if ( empty( $query_args['post_type'] ) && is_singular() ) {
    58                                 $query_args['post_type'] = get_post_type( get_the_ID() );
    59                         }
    60                 }
     51                $query = clone $wp_query;
     52        } else {
     53                $query_args = build_query_vars_from_query_block( $block, $page );
     54                $query      = new WP_Query( $query_args );
    6155        }
    62 
    63         $query = new WP_Query( $query_args );
    6456
    6557        if ( ! $query->have_posts() ) {
     
    108100        }
    109101
     102        /*
     103         * Use this function to restore the context of the template tags
     104         * from a secondary query loop back to the main query loop.
     105         * Since we use two custom loops, it's safest to always restore.
     106        */
    110107        wp_reset_postdata();
    111108
Note: See TracChangeset for help on using the changeset viewer.