- if ( 0 === strpos( $action, 'post-quickpress' ) ) {
- $_POST['post_ID'] = $post_id;
- // output the quickpress dashboard widget
- require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
- wp_dashboard_quick_press();
- exit;
- }
+ if ( ! current_user_can( 'edit_posts' ) )
+ $error_msg = __( 'Oops, you don’t have access to add new drafts.' );
+
+ if ( $error_msg )
+ return wp_dashboard_quick_press( $error_msg );
+
+ $post = get_post( $_REQUEST['post_ID'] );
+ check_admin_referer( 'add-' . $post->post_type );
+
+ $_POST['comment_status'] = get_option( 'default_comment_status' );
+ $_POST['ping_status'] = get_option( 'default_ping_status' );
+
+ edit_post();
+ wp_dashboard_quick_press();
+ exit;