Opened 15 years ago
Closed 15 years ago
#12867 closed defect (bug) (fixed)
"Preview Changes" does not work for custom content types
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 3.0 | Priority: | high |
Severity: | major | Version: | 3.0 |
Component: | Posts, Post Types | Keywords: | has-patch needs-testing |
Focuses: | Cc: |
Description
If you click "Preview Changes" for a custom post type item, you receive the message "Are you sure you want to do this?"
Likely a nonce mismatch issue. Here is the test code to add a custom post type:
register_post_type( 'album', array( 'label' => __('Albums'), 'singular_label' => __('Album'), 'public' => true, 'show_ui' => true, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'page', 'hierarchical' => false, 'rewrite' => true, 'query_var' => 'album', 'supports' => array('title', 'thumbnail') ));
Attachments (2)
Change History (7)
#2
@
15 years ago
Don't see why there would be a reason for the four nonce fields to be inside the check for the post type supporting the editor (please correct me and tell me why if I'm wrong!).
Therfore, also fixes: unable to persist rearranged/hidden meta-boxes on custom post type pages & being unable to edit permalink for custom post types (though I cannot seem to get these permalinks to work anyway :S).
#3
@
15 years ago
Some nonces can be restricted to a certain feature, but yeah, grouping them in 'editor' can do some damage. For example, we also currently require a post type support of 'title' to show the permalink settings.
#4
@
15 years ago
- Keywords has-patch needs-testing added; custom post types preview changes removed
Moves samplepermalink nonce into title support conditional. Removes getpermalink nonce as this is no longer used (see r9473 on autosave.js - perhaps get-permalink case in admin-ajax.php can also be removed?). Moves the other nonce fields out of the editor support conditional and up to the other hidden fields.
case 'preview'
in wp-admin/post.php checks for valid 'autosavenonce' (line 268). This is only present in the post editing page if the editor is present (edit-form-advanced.php line 244). This can be tested by adding'editor'
to the supports array, you should find that you can now preview changes. Definitely needs a fix, also noticed this whilst looking into some other bugs (http://core.trac.wordpress.org/ticket/11082#comment:26)