More custom post type support. Props scribu. see #9674
git-svn-id: http://svn.automattic.com/wordpress/trunk@12597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -126,6 +126,7 @@ case 'edit':
|
||||
}
|
||||
$post_ID = $p = (int) $_GET['post'];
|
||||
$post = get_post($post_ID);
|
||||
$post_type_object = get_post_type_object($post->post_type);
|
||||
|
||||
if ( empty($post->ID) )
|
||||
wp_die( __('You attempted to edit a post that doesn’t exist. Perhaps it was deleted?') );
|
||||
@@ -136,11 +137,20 @@ case 'edit':
|
||||
if ( 'trash' == $post->post_status )
|
||||
wp_die( __('You can’t edit this post because it is in the Trash. Please restore it and try again.') );
|
||||
|
||||
if ( 'post' != $post->post_type ) {
|
||||
if ( null == $post_type_object )
|
||||
wp_die( __('Unknown post type.') );
|
||||
|
||||
if ( 'post' != $post->post_type && $post_type_object->_builtin ) {
|
||||
wp_redirect( get_edit_post_link( $post->ID, 'url' ) );
|
||||
exit();
|
||||
}
|
||||
|
||||
$post_type = $post->post_type;
|
||||
if ( 'post' != $post_type ) {
|
||||
$parent_file = "edit.php?post_type=$post_type";
|
||||
$submenu_file = "edit.php?post_type=$post_type";
|
||||
}
|
||||
|
||||
wp_enqueue_script('post');
|
||||
if ( user_can_richedit() )
|
||||
wp_enqueue_script('editor');
|
||||
@@ -157,7 +167,7 @@ case 'edit':
|
||||
wp_enqueue_script('autosave');
|
||||
}
|
||||
|
||||
$title = __('Edit Post');
|
||||
$title = sprintf(__('Edit %s'), $post_type_object->label);
|
||||
$post = get_post_to_edit($post_ID);
|
||||
|
||||
include('edit-form-advanced.php');
|
||||
|
||||
Reference in New Issue
Block a user