WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 16 months ago

#18872 closed defect (bug) (worksforme)

Preview of drafted posts not possible when front page is set to a static page

Reported by: jnthnlstr Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2.1
Component: General Keywords: reporter-feedback
Focuses: Cc:

Description

Problem: It is not possible to preview posts when you have set your front page to be a static page

Steps to reproduce:

  • create a new blog
  • create a page
  • go to Settings->Reading
  • select your page in the 'static page' for the front page

Then, there are some variants...

1st variant:

  • create a new post, do not publish
  • do not click 'save draft'
  • click 'preview'
  • observe: visible front page, URL is like /?p=78&preview=true

2nd variant:

  • create a new post, do not publish
  • click 'save draft'
  • click 'preview'
  • observe: visible front page, URL is like /?p=80&preview=true

3rd variant:

  • create a new post
  • publish
  • make a change
  • hit 'preview changes'
  • observe: correct page preview, URL is like /new-post-three?preview=true&preview_id=83&preview_nonce=084e8f6b22

4th variant:

  • create a new post
  • publish
  • change status to 'draft', click 'update'
  • hit 'preview'
  • observe: visible front page, URL is like /?p=86&preview=true

Conclusion: draft pages not previewable when front page set to static page.

Change History (4)

comment:1 dd323 years ago

  • Keywords reporter-feedback added; dev-feedback removed

Are you running any form of caching? I can't duplicate this.

What Permalink settings are you using? Do you see the same with the Default (ugly - ?p=123) as you do with /%postname%/ (Which is what I assume you're using?)

comment:2 SergeyBiryukov3 years ago

I imagine this could happen if this block in query.php runs when it shouldn't:
http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/query.php#L2004

Normally, when doing a preview, the first two conditions aren't satisfied at the same time.
But when I tried to hook into pre_get_posts and set $query->is_home = 1, the results I got were similar to the ticket description.

This also reminded me of #13779 (having cookie issues due to different URLs for "WordPress Address" and "Site Address"), but in that case, 404 template would be displayed, not the front page.

Last edited 3 years ago by SergeyBiryukov (previous) (diff)

comment:3 dd323 years ago

Hm, Definately, if something is hooking into the Query parsing, and modifying the query when it shouldn't be, it'll definitely cause that. Might need to do some investigating, but is_home shouldn't be true for the preview URL's, nor should it be parsing it as the front page.

comment:4 SergeyBiryukov16 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Feel free to reopen with more information if there's still a problem.

Note: See TracTickets for help on using tickets.