| @@ -18,9 +18,10 @@ | ||
| 18 | 18 | */ |
| 19 | 19 | function gutenberg_render_block_core_query( $attributes, $content, $block ) { |
| 20 | 20 | $is_interactive = isset( $attributes['enhancedPagination'] ) |
| 21 | 21 | && true === $attributes['enhancedPagination'] |
| 22 | - && isset( $attributes['queryId'] ); | |
| 22 | + && isset( $attributes['queryId'] ) | |
| 23 | + && is_scalar( $attributes['queryId'] ); | |
| 23 | 24 | |
| 24 | 25 | // Enqueue the script module and add the necessary directives if the block is |
| 25 | 26 | // interactive. |
| 26 | 27 | if ( $is_interactive ) { |
| @@ -87,9 +88,9 @@ | ||
| 87 | 88 | static $render_query_callback = null; |
| 88 | 89 | |
| 89 | 90 | $block_name = $parsed_block['blockName']; |
| 90 | 91 | $block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block_name ); |
| 91 | - $has_enhanced_pagination = isset( $parsed_block['attrs']['enhancedPagination'] ) && true === $parsed_block['attrs']['enhancedPagination'] && isset( $parsed_block['attrs']['queryId'] ); | |
| 92 | + $has_enhanced_pagination = isset( $parsed_block['attrs']['enhancedPagination'] ) && true === $parsed_block['attrs']['enhancedPagination'] && isset( $parsed_block['attrs']['queryId'] ) && is_scalar( $parsed_block['attrs']['queryId'] ); | |
| 92 | 93 | /* |
| 93 | 94 | * Client side navigation can be true in two states: |
| 94 | 95 | * - supports.interactivity = true; |
| 95 | 96 | * - supports.interactivity.clientNavigation = true; |
| @@ -106,14 +107,14 @@ | ||
| 106 | 107 | * rendering when a plugin block has been found inside. It does so |
| 107 | 108 | * by adding an attribute called `data-wp-navigation-disabled` which |
| 108 | 109 | * is later handled by the front-end logic. |
| 109 | 110 | * |
| 110 | - * @param string $content The block content. | |
| 111 | - * @param array $block The full block, including name and attributes. | |
| 111 | + * @param string $content The block content. | |
| 112 | + * @param array $block The full block, including name and attributes. | |
| 112 | 113 | * @return string Returns the modified output of the query block. |
| 113 | 114 | */ |
| 114 | 115 | $render_query_callback = static function ( $content, $block ) use ( &$enhanced_query_stack, &$dirty_enhanced_queries, &$render_query_callback ) { |
| 115 | - $has_enhanced_pagination = isset( $block['attrs']['enhancedPagination'] ) && true === $block['attrs']['enhancedPagination'] && isset( $block['attrs']['queryId'] ); | |
| 116 | + $has_enhanced_pagination = isset( $block['attrs']['enhancedPagination'] ) && true === $block['attrs']['enhancedPagination'] && isset( $block['attrs']['queryId'] ) && is_scalar( $block['attrs']['queryId'] ); | |
| 116 | 117 | |
| 117 | 118 | if ( ! $has_enhanced_pagination ) { |
| 118 | 119 | return $content; |
| 119 | 120 | } |