Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#8052 closed defect (bug) (fixed)

Previewing published post doesn't use the proper template

Reported by: johnconners Owned by:
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.7
Component: General Keywords:
Focuses: Cc:


If I edit a published post I see that the publish module has the 'Preview' button visible in the secondary area. Clicking Preview opens a page that doesn't actually preview the post itself, but shows the post as though it were being seen from an archive page. An example URL is:


From this page clicking the link to view the post itself results in a 404 while attempting to show this URL:


My permalink structure is: archives/%year%/%monthnum%/%postname%/ and the live URL is in fact:


If I change the post status to 'Draft' and click 'Preview' then the preview of the post is correctly shown (just the same as in 2.6.x) at:


I'd expect when the post is published that the 'Preview' button would be replaced with 'View Post' or something similar which would redirect to the live post URL.

One other observation I've made is that as soon as I click 'Preview' an autosave is created in the database for that post if there isn't one already. Maybe irrelevant but thought it was worth a mention.

Change History (5)

#1 @johnconners
7 years ago

  • Version set to 2.7

#2 @azaozz
7 years ago

  • Summary changed from Confusing behaviour of 'Preview' button on published posts to Previewing published post doesn't use the proper template

Both observations are correct: clicking Preview on already published post shows that post including the latest changes made just before previewing it. These changes are not yet saved and visible on the blog. Currently not all query vars are set correctly so this uses the home template instead of single.php/page.php.

Clicking preview immediately after starting a new post runs autosave manually (same as in 2.6) so there is a post to preview (there's nothing in the db before that). This is only needed when previewing a new post befire entering a title.

#3 @johnconners
7 years ago

Ah right, thanks for the clarification! I didn't realise that the idea of preview on published posts was to see unsaved changes - neat!

#4 @azaozz
7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [9509]) Preview fixes: different method of showing previews for published posts, now uses the proper templates. Fixes #8052

#5 @jacobsantos
7 years ago

  • Milestone changed from 2.8 to 2.7
Note: See TracTickets for help on using tickets.