#8052 closed defect (bug) (fixed)
Previewing published post doesn't use the proper template
| Reported by: | johnconners | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.7 |
| Component: | General | Version: | 2.7 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
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:
http://localhost/wptrunk/?wp_preview=1258&preview_nonce=1234f7fbbb
From this page clicking the link to view the post itself results in a 404 while attempting to show this URL:
http://localhost/wptrunk/archives/2008/11/1258-autosave/
My permalink structure is: archives/%year%/%monthnum%/%postname%/ and the live URL is in fact:
http://localhost/wptrunk/archives/2008/11/this-is-a-new-post/
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:
http://localhost/wptrunk/?p=1258&preview=true
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)
#2
@
18 years ago
- Summary Confusing behaviour of 'Preview' button on published posts → Previewing published post doesn't use the proper template
#3
@
18 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!
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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.