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

Query Loop displaying incorrect number of posts in the Editor with "inherit query" enabled #71712

Closed
jp-imagines opened this issue Jan 5, 2023 · 3 comments
Labels
[Platform] Atomic [Platform] Simple [Pri] Low Address when resources are available. [Status] Core Fix Needed A fix within the Core WordPress or Gutenberg project is required to resolve this issue. Triaged To be used when issues have been triaged. [Type] Bug

Comments

@jp-imagines
Copy link

Quick summary

On templates which default to using a Query Loop with the "Inherit query from template" setting enabled (e.g. Home, Index, Archive, Search, etc.), there can be a mismatch between the number of posts displayed in the Site Editor vs. the number of posts displayed on the live site. It seems this stems from any discrepancy between the "Items per page" setting on the Query Loop block (not accessible with "Inherit query from template" enabled) and the "Blog pages show at most" setting from Settings > Reading.

Steps to reproduce

  1. Start with a site which has a block/FSE theme active and at least a handful or so of published posts.
  2. At Settings > Reading, set the "Blog pages show at most" setting to a small value (e.g. 5).
  • For simplicity, you can also set the homepage to display latest posts and test on the Home or Index template (depending on theme). Otherwise, you can test from the Archive or Search template.
  1. Open the Site Editor (Appearance > Editor) and open one of the templates mentioned above.
  2. Ensure the "Inherit query from template" setting is enabled and count the number of posts displayed in the Query Loop in the Editor.
  • If not many posts are displayed by default on your theme, disable the "Inherit query from template" setting, use the settings toggle in the floating toolbar to increase the "Items per page" value, and then re-enable the "Inherit query from template" toggle.
  1. Save changes (if necessary) and view a corresponding page on the live site. Count the number of post displayed.

What you expected to happen

The number of posts displayed in the Editor should match what's displayed on the live site.

It seems odd/unexpected that you can't control the number of posts displayed in a Query Loop if the "Inherit query from template" setting is enabled, and instead a separate WP Admin setting is required to control that outside the Editor (which then doesn't reflect in the Editor).

What actually happened

As an example, in my testing, I had set "Blog pages show at most" to 5. The Query Loop on the Twenty Twenty-Two theme's Home template defaulted to displaying 8 posts per page, so 8 posts were displayed in the Editor. Only 5 appear on the live "latest posts" homepage.

Context

38832399-hc (with some discussion at p1671738151370229-slack-C03TY6J1A)
36734787-hc

Platform (Simple, Atomic, or both?)

Simple, Atomic

Theme-specific issue?

Doesn't appear theme-specific. Tested on Twenty Twenty-Two and Quadrat, user reports both came from Masu.

Browser, operating system and other notes

No response

Reproducibility

Consistent

Severity

Some (< 50%)

Available workarounds?

Yes, easy to implement

Workaround details

The number of posts on the live site for Query Loops with "inherited" queries is set in Settings > Reading. This can be made to match in the editor by disabling the "Inherit query from template" toggle, modifying the "Items per page" setting, and then re-enabling the toggle.

@jp-imagines jp-imagines added [Type] Bug [Pri] Low Address when resources are available. User Report labels Jan 5, 2023
@vinnykaur vinnykaur added the Triaged To be used when issues have been triaged. label Feb 16, 2023
@vinnykaur
Copy link

📌 SCRUBBING : RESULT

  • Tested on Simple - Replicated
  • Tested on AT - Replicated

📌 FINDINGS/SCREENSHOTS/VIDEO

  • I was able to replicate with Twenty Twenty-two and Quadrat themes but not on Blank Canvas or the Bitácora theme, for example. So this seems to have affected some themes but not all.

Screen record from my test site using Twenty Twenty-two theme where query block shows 10 posts but the live site shows only 5.

Screen.Recording.2023-02-16.at.3.14.31.PM.mov

The same thing can be replicated on an atomic site using these themes.

📌 ACTIONS

  • Marked as Triaged for Quality Squad review

@mrfoxtalbot
Copy link

I ran into this today while helping a user.

Just noting that this comes from core and is already being discussed in WordPress/gutenberg#29821 and WordPress/gutenberg#41548

@mrfoxtalbot mrfoxtalbot added the [Status] Core Fix Needed A fix within the Core WordPress or Gutenberg project is required to resolve this issue. label Feb 2, 2024
@matticbot matticbot moved this from Needs Triage to Triaged in Automattic Prioritization: The One Board ™ Feb 2, 2024
@mrfoxtalbot mrfoxtalbot moved this to To triage in Dotcom Core Fix Needed Sep 2, 2024
@inaikem inaikem moved this from Triaged to Done 🎉 in Automattic Prioritization: The One Board ™ Nov 6, 2024
@inaikem
Copy link
Contributor

inaikem commented Nov 6, 2024

It appears to be fixed based on the first Core issue noted above. Tentatively closing now. Please reopen as needed if there are new reports.

@inaikem inaikem closed this as completed Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Platform] Atomic [Platform] Simple [Pri] Low Address when resources are available. [Status] Core Fix Needed A fix within the Core WordPress or Gutenberg project is required to resolve this issue. Triaged To be used when issues have been triaged. [Type] Bug
Development

No branches or pull requests

4 participants