Make WordPress Core


Ignore:
Timestamp:
02/25/2025 05:10:31 AM (4 months ago)
Author:
Mamaduka
Message:

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.

File:
1 edited

Legend:

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

    r59839 r59866  
    25652565                $query['post__in']            = ! empty( $sticky ) ? $sticky : array( 0 );
    25662566                $query['ignore_sticky_posts'] = 1;
    2567             } else {
     2567            } elseif ( 'exclude' === $block->context['query']['sticky'] ) {
    25682568                $query['post__not_in'] = array_merge( $query['post__not_in'], $sticky );
     2569            } elseif ( 'ignore' === $block->context['query']['sticky'] ) {
     2570                $query['ignore_sticky_posts'] = 1;
    25692571            }
    25702572        }
Note: See TracChangeset for help on using the changeset viewer.