Make WordPress Core

Opened 6 weeks ago

Closed 3 weeks ago

Last modified 3 weeks ago

#62908 closed enhancement (fixed)

Editor: Add option to ignore sticky posts in Query block

Reported by: mamaduka's profile Mamaduka Owned by: mamaduka's profile Mamaduka
Milestone: 6.8 Priority: normal
Severity: normal Version:
Component: Editor Keywords: gutenberg-merge has-patch has-unit-tests add-to-field-guide has-testing-info commit
Focuses: Cc:

Description

Introduce a new ignore value for the sticky query argument. When this value is used, the query won't prepend sticky posts at the top; instead, it will display them in the natural order of the query.

Gutenberg PR: https://github.com/WordPress/gutenberg/pull/69057.

Attachments (5)

Screenshot 2025-02-06 150018.png (60.5 KB) - added by mikinc860 6 weeks ago.
Screenshot 2025-02-06 150041.png (116.3 KB) - added by mikinc860 6 weeks ago.
exclude-sticky.png (95.7 KB) - added by dhruvishah2203 3 weeks ago.
Exclude sticky post from the list
include-sticky.png (107.9 KB) - added by dhruvishah2203 3 weeks ago.
Include sticky post and display at top
sticky-only.png (62.3 KB) - added by dhruvishah2203 3 weeks ago.
Display only sticky post

Download all attachments as: .zip

Change History (18)

This ticket was mentioned in PR #8265 on WordPress/wordpress-develop by @Mamaduka.


6 weeks ago
#1

  • Keywords has-patch added

Introduce a new ignore value for the sticky query argument. When this value is used, the query won't prepend sticky posts at the top; instead, it will display them in the natural order of the query.

Related: https://github.com/WordPress/wordpress-develop/pull/8228
Gutenberg PR: https://github.com/WordPress/gutenberg/pull/69057
Trac ticket: https://core.trac.wordpress.org/ticket/62908#ticket

#2 @mikinc860
6 weeks ago

Test Report

This report confirms the functionality of the patch provided.
Tested Patch: https://github.com/WordPress/wordpress-develop/pull/8265

Environment

OS: Windows 11
Web Server: WordPress Playground
PHP: Playground Default
WordPress Version: 6.8-alpha-20250125.203533
Browser: Chrome
Theme: Twenty Twenty-Five v1.0
Active Plugins: None

Actual Results

Front-end behavior: The patch resolved the issue successfully.
Backend behavior: When sticky posts are selected to be included, the query does not prepend sticky posts at the top, instead displaying them in the natural order of the query.

#3 @poena
6 weeks ago

Hi @mikinc860

Thank you for testing. The result that you are seeing is caused by a different bug.

The control to ignore the sticky post has not been added to the block yet. The new option can only be tested once the JavaScript has been added as part of a package update.

@Mamaduka commented on PR #8265:


4 weeks ago
#4

Thanks for pushing the tests, @peterwilsoncc 🙇

@audrasjb commented on PR #8265:


4 weeks ago
#5

Appart from the couple wpcs issues reported by Peter this looks good to me 👍 Concerning the post__not_in specific concern, this will need to be documented at least in a dev note, but I think an inline comment somewhere would be ideal.

#6 @audrasjb
4 weeks ago

  • Keywords has-unit-tests needs-dev-note added

#7 @Mamaduka
4 weeks ago

@audrasjb, what type of dev note do you have in mind? Should I combine all sticky post-related updates in a single dev note?

@Mamaduka commented on PR #8265:


4 weeks ago
#8

@peterwilsoncc, @audrasjb let me know if this is good to commit.

#9 @audrasjb
4 weeks ago

  • Keywords add-to-field-guide added

@Mamaduka this, or put a section in one of the editor related dev note. Maybe you have a "Block Change" dev note in mind?

Otherwise, we can also just add a section to the general Field Guide. Adding the add-to-field-guide keyword just in case :)

#10 @dhruvishah2203
3 weeks ago

  • Keywords has-testing-info added; needs-dev-note removed

Test Report

This report confirms the functionality of the patch provided.
Tested Patch: https://github.com/WordPress/wordpress-develop/pull/8265

Environment

OS: Windows 11
Web Server: WordPress Playground
PHP: Playground Default
WordPress Version: 6.8-alpha-20250125.203533
Browser: Chrome
Theme: Twenty Twenty-Five v1.0
Active Plugins: None

Actual Results

✅ Front-end behavior: The patch resolved the issue successfully.
✅ Backend behavior: The patch resolved the issue successfully.

@dhruvishah2203
3 weeks ago

Exclude sticky post from the list

@dhruvishah2203
3 weeks ago

Include sticky post and display at top

@dhruvishah2203
3 weeks ago

Display only sticky post

#11 @joemcgill
3 weeks ago

  • Keywords commit added
  • Owner set to Mamaduka
  • Status changed from new to assigned

Marking this for commit based on PR approvals from @audrasjb and @peterwilsoncc. @Mamaduka I've set you as the assignee but feel free to reassign if someone else intends to commit this.

#12 @Mamaduka
3 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 59866:

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.

Note: See TracTickets for help on using tickets.