Make WordPress Core

Opened 20 months ago

Closed 20 months ago

Last modified 17 months ago

#62908 closed enhancement (fixed)

Editor: Add option to ignore sticky posts in Query block

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

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 20 months ago.
Screenshot 2025-02-06 150041.png​ (116.3 KB ) - added by mikinc860 20 months ago.
exclude-sticky.png​ (95.7 KB ) - added by dhruvishah2203 20 months ago.
Exclude sticky post from the list
include-sticky.png​ (107.9 KB ) - added by dhruvishah2203 20 months ago.
Include sticky post and display at top
sticky-only.png​ (62.3 KB ) - added by dhruvishah2203 20 months ago.
Display only sticky post

Download all attachments as: .zip

Change History (19)

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


20 months 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
20 months 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
20 months 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:


20 months ago
#4

Thanks for pushing the tests, @peterwilsoncc 🙇

​@audrasjb commented on ​PR #8265:


20 months 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
20 months ago

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

#7 @Mamaduka
20 months 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:


20 months ago
#8

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

#9 @audrasjb
20 months 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
20 months 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
20 months ago

Exclude sticky post from the list

@dhruvishah2203
20 months ago

Include sticky post and display at top

@dhruvishah2203
20 months ago

Display only sticky post

#11 @joemcgill
20 months ago

  • Keywords commit added
  • Owner set to Mamaduka
  • Status new → 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
20 months ago

  • Resolution → fixed
  • Status assigned → 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.

#14 @wordpressdotorg
17 months ago

  • Keywords has-test-info added; has-testing-info removed
Note: See TracTickets for help on using tickets.