Make WordPress Core


Ignore:
Timestamp:
08/23/2022 03:40:25 PM (3 years ago)
Author:
gziolo
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 SergeyBiryukov.
Fixes #56414.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/post-template.php

    r53644 r53929  
    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.