Make WordPress Core

Opened 18 months ago

Last modified 9 months ago

#49969 new defect (bug)

Previewing the page designated as "latest posts" shows the frontpage

Reported by: zieladam Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: needs-patch
Focuses: Cc:

Description (last modified by zieladam)

This continues the discussion from https://github.com/WordPress/gutenberg/issues/2409

The issue

  • Create two pages (let's call them "My home" and "My posts")
  • Go to customizer and set Homepage to be "My home" and Posts page to "My posts"
  • Edit "My posts" in editor mode
  • Press preview
  • Confirm you got "My home" instead of "My posts"

The root cause

When you click "Open preview in new tab" while editing "My posts", Gutenberg redirects to a preview URL like this one:


When you visit that URL, WordPress will load the front page instead of the posts page. This is because class-wp-query.php assumes that posts page is also the front page:


Then, when rendering a preview, it substitutes the page_id that was requested with the value of get_option( 'page_on_front' ):


If I remove the preview parameters and leave only ?page_id=5, it displays the correct page.

Change History (7)

#1 @zieladam
18 months ago

  • Description modified (diff)

#2 @joyously
18 months ago

As stated in the GitHub issue, that issue was only a continuation of #34005

Last edited 18 months ago by SergeyBiryukov (previous) (diff)

#3 @zieladam
18 months ago

In my understanding, #34005 is about re-enabling the Visual Editor and Page Template dropdown when editing the page for Posts. The discussion in the Gutenberg issue https://github.com/WordPress/gutenberg/issues/2409 pivoted towards the results of previewing the page marked as "Posts page" - which indeed is unexpected due to a bug. I believe this constitutes it's own issue.

Last edited 18 months ago by SergeyBiryukov (previous) (diff)

This ticket was mentioned in Slack in #core by joyously. View the logs.

18 months ago

This ticket was mentioned in Slack in #core by joyously. View the logs.

10 months ago

#6 @SergeyBiryukov
10 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

This ticket was mentioned in Slack in #core by joyously. View the logs.

9 months ago

Note: See TracTickets for help on using tickets.