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 );
$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 );
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 );
wp_die( __( 'You can’t edit this item because it is in the Trash. Please restore it and try again.' ) );
if ( ! empty( $_GET['get-post-lock'] ) ) {
+ check_admin_referer( 'lock-post_' . $post_id );
wp_set_post_lock( $post_id );
wp_redirect( get_edit_post_link( $post_id, 'url' ) );
exit();