Skip to content

Latest Posts: Make Latest Posts block consistent with sticky posts display #69428

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

Conversation

himanshupathak95
Copy link
Contributor

@himanshupathak95 himanshupathak95 commented Mar 5, 2025

What?

Closes #69424

This PR addresses the inconsistency between how the Latest Posts block displays posts in the editor versus the front end. Previously, sticky posts would always appear at the top of the list in the editor, regardless of the sorting parameters, but would display in their chronological position on the front end.

The fix adds the ignore_sticky: true parameter to the post query in the editor, ensuring that sticky posts are treated the same in both contexts. They are displayed according to the selected ordering parameters rather than being prioritized at the top.

Why?

The Latest Posts block should respect the specified ordering parameters and display posts consistently between the editor and the front end. The current inconsistency creates a confusing user experience where what users see in the editor doesn't match what visitors see on the published page.

How?

This PR adds the ignore_sticky: true parameter to the query in the Latest Posts block's editor component.

Testing Instructions

  • Create several posts, and mark some of them as "sticky"
  • Create or edit a post
  • Add a Latest Posts block to the page
  • Observe how the posts are ordered in the editor - verify that sticky posts now appear in their chronological order, not at the top
  • Publish or update the page
  • View the page on the front end and verify that the post order matches what was shown in the editor
  • In the block settings, try changing the sort order (oldest to newest, or A→Z) and verify that the sticky posts respect this ordering in both the editor and front end

Screencast

Screen.Recording.2025-03-05.at.15.28.10.mov

@himanshupathak95 himanshupathak95 marked this pull request as ready for review March 5, 2025 10:00
Copy link

github-actions bot commented Mar 5, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: himanshupathak95 <abcd95@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Block] Latest Posts Affects the Latest Posts Block [Type] Regression Related to a regression in the latest release and removed [Type] Bug An existing feature does not function as intended labels Mar 5, 2025
@github-project-automation github-project-automation bot moved this to 🔎 Needs Review in WordPress 6.8 Editor Tasks Mar 5, 2025
@Mamaduka Mamaduka self-requested a review March 5, 2025 10:29
@carolinan carolinan added the Backport to WP 6.8 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Mar 5, 2025
Copy link
Contributor

@carolinan carolinan left a comment

Choose a reason for hiding this comment

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

The sticky posts are not sticky anymore and the sorting is also working well, thank you.

@Mamaduka Mamaduka merged commit 98622bf into WordPress:trunk Mar 5, 2025
74 of 77 checks passed
@github-project-automation github-project-automation bot moved this from 🔎 Needs Review to ✅ Done in WordPress 6.8 Editor Tasks Mar 5, 2025
@github-actions github-actions bot added this to the Gutenberg 20.5 milestone Mar 5, 2025
@github-actions github-actions bot removed the Backport to WP 6.8 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Mar 5, 2025
gutenbergplugin pushed a commit that referenced this pull request Mar 5, 2025
…splay (#69428)

Co-authored-by: himanshupathak95 <abcd95@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>
@github-actions github-actions bot added the Backported to WP Core Pull request that has been successfully merged into WP Core label Mar 5, 2025
Copy link

github-actions bot commented Mar 5, 2025

I just cherry-picked this PR to the wp/6.8 branch to get it included in the next release: bc06abf

chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
…splay (WordPress#69428)

Co-authored-by: himanshupathak95 <abcd95@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported to WP Core Pull request that has been successfully merged into WP Core [Block] Latest Posts Affects the Latest Posts Block [Type] Regression Related to a regression in the latest release
Projects
Development

Successfully merging this pull request may close these issues.

The latest posts blocks show sticky posts on top in the editor but not the front
3 participants