equal
deleted
inserted
replaced
19 $post_type_object = get_post_type_object( $post_type ); |
19 $post_type_object = get_post_type_object( $post_type ); |
20 |
20 |
21 if ( 'post' == $post_type ) { |
21 if ( 'post' == $post_type ) { |
22 $parent_file = 'edit.php'; |
22 $parent_file = 'edit.php'; |
23 $submenu_file = 'post-new.php'; |
23 $submenu_file = 'post-new.php'; |
|
24 } elseif ( 'attachment' == $post_type ) { |
|
25 wp_redirect( admin_url( 'media-new.php' ) ); |
|
26 exit; |
24 } else { |
27 } else { |
25 $submenu_file = "post-new.php?post_type=$post_type"; |
28 $submenu_file = "post-new.php?post_type=$post_type"; |
26 if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) { |
29 if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) { |
27 $parent_file = $post_type_object->show_in_menu; |
30 $parent_file = $post_type_object->show_in_menu; |
28 if ( ! isset( $_registered_pages[ get_plugin_page_hookname( "post-new.php?post_type=$post_type", $post_type_object->show_in_menu ) ] ) ) |
31 if ( ! isset( $_registered_pages[ get_plugin_page_hookname( "post-new.php?post_type=$post_type", $post_type_object->show_in_menu ) ] ) ) |
34 |
37 |
35 $title = $post_type_object->labels->add_new_item; |
38 $title = $post_type_object->labels->add_new_item; |
36 |
39 |
37 $editing = true; |
40 $editing = true; |
38 |
41 |
39 if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) |
42 if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_can( $post_type_object->cap->create_posts ) ) |
40 wp_die( __( 'Cheatin’ uh?' ) ); |
43 wp_die( __( 'Cheatin’ uh?' ) ); |
41 |
44 |
42 // Schedule auto-draft cleanup |
45 // Schedule auto-draft cleanup |
43 if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) |
46 if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) |
44 wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' ); |
47 wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' ); |
45 |
48 |
46 wp_enqueue_script('autosave'); |
49 wp_enqueue_script( 'autosave' ); |
47 |
50 |
48 // Show post form. |
51 // Show post form. |
49 $post = get_default_post_to_edit( $post_type, true ); |
52 $post = get_default_post_to_edit( $post_type, true ); |
50 $post_ID = $post->ID; |
53 $post_ID = $post->ID; |
51 include('edit-form-advanced.php'); |
54 include('edit-form-advanced.php'); |