]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/post.php
WordPress 4.2.3
[autoinstalls/wordpress.git] / wp-admin / post.php
index 805c46e6edf6e0461112c1d5196859eb567aba6a..52f1bda297fd146e054fa4901ed68853d86b6047 100644 (file)
@@ -23,7 +23,7 @@ elseif ( isset( $_POST['post_ID'] ) )
 else
        $post_id = $post_ID = 0;
 
 else
        $post_id = $post_ID = 0;
 
-$post = $post_type = $post_type_object = null;
+global $post_type, $post_type_object, $post;
 
 if ( $post_id )
        $post = get_post( $post_id );
 
 if ( $post_id )
        $post = get_post( $post_id );
@@ -95,7 +95,9 @@ if ( ! $sendback ||
                $sendback = admin_url( 'upload.php' );
        } else {
                $sendback = admin_url( 'edit.php' );
                $sendback = admin_url( 'upload.php' );
        } else {
                $sendback = admin_url( 'edit.php' );
-               $sendback .= ( ! empty( $post_type ) ) ? '?post_type=' . $post_type : '';
+               if ( ! empty( $post_type ) ) {
+                       $sendback = add_query_arg( 'post_type', $post_type, $sendback );
+               }
        }
 } else {
        $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback );
        }
 } else {
        $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback );
@@ -113,8 +115,9 @@ case 'post-quickdraft-save':
        if ( ! wp_verify_nonce( $nonce, 'add-post' ) )
                $error_msg = __( 'Unable to submit this form, please refresh and try again.' );
 
        if ( ! wp_verify_nonce( $nonce, 'add-post' ) )
                $error_msg = __( 'Unable to submit this form, please refresh and try again.' );
 
-       if ( ! current_user_can( 'edit_posts' ) )
-               $error_msg = __( 'Oops, you don’t have access to add new drafts.' );
+       if ( ! current_user_can( 'edit_posts' ) ) {
+               exit;
+       }
 
        if ( $error_msg )
                return wp_dashboard_quick_press( $error_msg );
 
        if ( $error_msg )
                return wp_dashboard_quick_press( $error_msg );