Move `redirect_post()` from `wp-admin/post.php` to `wp-admin/includes/post.php`.
See #33813. Built from https://develop.svn.wordpress.org/trunk@34020 git-svn-id: http://core.svn.wordpress.org/trunk@33989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f0b95b7bcc
commit
503aa8b76d
|
@ -1769,3 +1769,52 @@ function wp_autosave( $post_data ) {
|
||||||
return wp_create_post_autosave( wp_slash( $post_data ) );
|
return wp_create_post_autosave( wp_slash( $post_data ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redirect to previous page.
|
||||||
|
*
|
||||||
|
* @param int $post_id Optional. Post ID.
|
||||||
|
*/
|
||||||
|
function redirect_post($post_id = '') {
|
||||||
|
if ( isset($_POST['save']) || isset($_POST['publish']) ) {
|
||||||
|
$status = get_post_status( $post_id );
|
||||||
|
|
||||||
|
if ( isset( $_POST['publish'] ) ) {
|
||||||
|
switch ( $status ) {
|
||||||
|
case 'pending':
|
||||||
|
$message = 8;
|
||||||
|
break;
|
||||||
|
case 'future':
|
||||||
|
$message = 9;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$message = 6;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$message = 'draft' == $status ? 10 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) );
|
||||||
|
} elseif ( isset($_POST['addmeta']) && $_POST['addmeta'] ) {
|
||||||
|
$location = add_query_arg( 'message', 2, wp_get_referer() );
|
||||||
|
$location = explode('#', $location);
|
||||||
|
$location = $location[0] . '#postcustom';
|
||||||
|
} elseif ( isset($_POST['deletemeta']) && $_POST['deletemeta'] ) {
|
||||||
|
$location = add_query_arg( 'message', 3, wp_get_referer() );
|
||||||
|
$location = explode('#', $location);
|
||||||
|
$location = $location[0] . '#postcustom';
|
||||||
|
} else {
|
||||||
|
$location = add_query_arg( 'message', 4, get_edit_post_link( $post_id, 'url' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the post redirect destination URL.
|
||||||
|
*
|
||||||
|
* @since 2.9.0
|
||||||
|
*
|
||||||
|
* @param string $location The destination URL.
|
||||||
|
* @param int $post_id The post ID.
|
||||||
|
*/
|
||||||
|
wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
|
||||||
|
exit;
|
||||||
|
}
|
|
@ -38,55 +38,6 @@ if ( $post ) {
|
||||||
$post_type_object = get_post_type_object( $post_type );
|
$post_type_object = get_post_type_object( $post_type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Redirect to previous page.
|
|
||||||
*
|
|
||||||
* @param int $post_id Optional. Post ID.
|
|
||||||
*/
|
|
||||||
function redirect_post($post_id = '') {
|
|
||||||
if ( isset($_POST['save']) || isset($_POST['publish']) ) {
|
|
||||||
$status = get_post_status( $post_id );
|
|
||||||
|
|
||||||
if ( isset( $_POST['publish'] ) ) {
|
|
||||||
switch ( $status ) {
|
|
||||||
case 'pending':
|
|
||||||
$message = 8;
|
|
||||||
break;
|
|
||||||
case 'future':
|
|
||||||
$message = 9;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$message = 6;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$message = 'draft' == $status ? 10 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) );
|
|
||||||
} elseif ( isset($_POST['addmeta']) && $_POST['addmeta'] ) {
|
|
||||||
$location = add_query_arg( 'message', 2, wp_get_referer() );
|
|
||||||
$location = explode('#', $location);
|
|
||||||
$location = $location[0] . '#postcustom';
|
|
||||||
} elseif ( isset($_POST['deletemeta']) && $_POST['deletemeta'] ) {
|
|
||||||
$location = add_query_arg( 'message', 3, wp_get_referer() );
|
|
||||||
$location = explode('#', $location);
|
|
||||||
$location = $location[0] . '#postcustom';
|
|
||||||
} else {
|
|
||||||
$location = add_query_arg( 'message', 4, get_edit_post_link( $post_id, 'url' ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the post redirect destination URL.
|
|
||||||
*
|
|
||||||
* @since 2.9.0
|
|
||||||
*
|
|
||||||
* @param string $location The destination URL.
|
|
||||||
* @param int $post_id The post ID.
|
|
||||||
*/
|
|
||||||
wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( isset( $_POST['deletepost'] ) )
|
if ( isset( $_POST['deletepost'] ) )
|
||||||
$action = 'delete';
|
$action = 'delete';
|
||||||
elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] )
|
elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] )
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-alpha-34019';
|
$wp_version = '4.4-alpha-34020';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue