Making WordPress.org

Changeset 12413


Ignore:
Timestamp:
02/22/2023 05:00:52 AM (19 months ago)
Author:
dufresnesteven
Message:

wp-themes.com: Fix patterns with query block.

See: https://meta.trac.wordpress.org/ticket/6676

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wp-themes.com/public_html/wp-content/plugins/pattern-page/inc/page-intercept.php

    r12349 r12413  
    134134}
    135135add_action( 'pre_get_posts', __NAMESPACE__ . '\modify_pattern_page_query', 5 );
     136
     137/**
     138 * Updates query block 'inherit' parameter to false to fix post loading.
     139 * See: https://meta.trac.wordpress.org/ticket/6676
     140 *
     141 * @param array         $context
     142 * @param array         $parsed_block
     143 * @param WP_Block|null $parent_block
     144 * @return array
     145 */
     146function modify_query_block_context( $context, $parsed_block, $parent_block ) {
     147
     148    if ( 'core/query' === $parent_block->parsed_block['blockName'] ) {
     149        $context['query']['inherit'] = false;
     150    }
     151
     152    return $context;
     153}
     154
     155add_filter( 'render_block_context', __NAMESPACE__ . '\modify_query_block_context', 10, 3 );
Note: See TracChangeset for help on using the changeset viewer.