[wp-trac] [WordPress Trac] #12859: Preview new, blank page/post creates broken preview
WordPress Trac
wp-trac at lists.automattic.com
Mon Apr 5 13:46:59 UTC 2010
#12859: Preview new, blank page/post creates broken preview
--------------------------+-------------------------------------------------
Reporter: duck_ | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.0
Component: General | Version: 3.0
Severity: normal | Keywords: has-patch needs-testing
--------------------------+-------------------------------------------------
Steps:
1. Add new post or page, don't add any content
2. Click "Preview"
Actual:
Redirected to preview page with large number of errors.
Expected:
WordPress execution killed with message 'Preview not available. Please
save as a draft first.' (2.9.2 behaviour)
I believe this is occurring because all new pages and posts are now
created with a postID (see r12987). Therefore the check for $post_ID < 1
in post_preview() (wp-admin/includes/post.php, line 1288) is rendered
ineffective.
Instead of checking the post_ID variable I think the function should check
for status being auto_draft. However, if this is done, after autosaving a
title a new post will still generate this error when previewing (create
new post, type a title, let it autosave, click preview). This is because
in wp-admin/js/autosave.js (autosave_update_post_ID function) checks value
of #post_ID field against the newly autosaved ID, if they're equal the
function terminates and so #auto_draft field is not set to '0'. I think
the check was there to stop unnecessary ajax requests, but the function no
longer does this... removing this also has benefit of reenabling the
publishing buttons quicker than default 5000ms.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12859>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list