From b2fdfe280c059d42dd5d2fb1c68ac17ce106402d Mon Sep 17 00:00:00 2001 From: Mamaduka Date: Tue, 25 Feb 2025 05:12:23 +0000 Subject: [PATCH] Editor: Add option to ignore sticky posts in Query block. Introduce a new `ignore` value for the `sticky` query argument. When this value is used, the query will not prepend sticky posts at the top but display them in the natural order. Props mamaduka, peterwilsoncc, audrasjb, mikinc860, poena, dhruvishah2203, joemcgill. Fixes #62908. Built from https://develop.svn.wordpress.org/trunk@59866 git-svn-id: http://core.svn.wordpress.org/trunk@59208 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/blocks.php | 4 +++- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index 58e03d0155..4a9cf545e6 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -2564,8 +2564,10 @@ function build_query_vars_from_query_block( $block, $page ) { */ $query['post__in'] = ! empty( $sticky ) ? $sticky : array( 0 ); $query['ignore_sticky_posts'] = 1; - } else { + } elseif ( 'exclude' === $block->context['query']['sticky'] ) { $query['post__not_in'] = array_merge( $query['post__not_in'], $sticky ); + } elseif ( 'ignore' === $block->context['query']['sticky'] ) { + $query['ignore_sticky_posts'] = 1; } } if ( ! empty( $block->context['query']['exclude'] ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 8bfb82aef0..78bb666236 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-alpha-59865'; +$wp_version = '6.8-alpha-59866'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.