Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all posts showing when no posts are sticky #4144

Closed
wants to merge 4 commits into from

Conversation

RavanH
Copy link

@RavanH RavanH commented Feb 28, 2023

This fixes the issue where all non-sticky posts show up in the Query Loop block when Sticky Posts is set to "Only" and there are no sticky posts.

Additional (array) typecast for safety.

See https://core.trac.wordpress.org/ticket/57822

Trac ticket:


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

This fixes the issue where all non-sticky posts show up in the Query Loop block when Sticky Posts is set to "Only" and there are no sticky posts. 

Additional `(array)` typecast for safety.

See https://core.trac.wordpress.org/ticket/57822
Copy link

@sc0ttkclark sc0ttkclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bug has always irked me :)

@sc0ttkclark
Copy link

sc0ttkclark commented Feb 28, 2023

We probably should add a test for this for the query loop block

src/wp-includes/blocks.php Outdated Show resolved Hide resolved
Co-authored-by: Dominik Schilling <dominikschilling+git@gmail.com>
Copy link

@ntsekouras ntsekouras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@hellofromtonya
Copy link
Contributor

Commits 526d9b1 and 2164f1f bring full parity with the changes in Gutenberg https://github.com/WordPress/gutenberg/blob/42dad571eac32c41a7ff34f0da80fcc4e5ceb3bd/lib/compat/wordpress-6.1/blocks.php#L171-L183 to synchronize Core and Gutenberg.

@ntsekouras
Copy link

Just for reference, the function will be under 6.2 compat folder , since we are including this change now.

So some links for GB in comments would be different.

Copy link
Contributor

@hellofromtonya hellofromtonya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Confirmed the changes match the changes in Gutenberg ✅
  • Test Report confirms this PR fixes the reported issue ✅

Ready for commit 👍

@hellofromtonya
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants