* @param int $post_id Optional. Post ID.
*/
function redirect_post($post_id = '') {
- if ( !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) {
- if ( isset($_POST['saveasdraft']) )
- $location = 'sidebar.php?a=c';
- elseif ( isset($_POST['publish']) )
- $location = 'sidebar.php?a=b';
- } elseif ( isset($_POST['save']) || isset($_POST['publish']) ) {
+ if ( isset($_POST['save']) || isset($_POST['publish']) ) {
$status = get_post_status( $post_id );
if ( isset( $_POST['publish'] ) ) {
}
wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
+ exit;
}
if ( isset( $_POST['deletepost'] ) )
$editing = true;
if ( empty( $post_id ) ) {
- wp_redirect("post.php");
+ wp_redirect( admin_url('post.php') );
exit();
}
$parent_file = "edit.php";
$submenu_file = "edit.php";
} else {
- $parent_file = "edit.php?post_type=$post_type";
+ if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true )
+ $parent_file = $post_type_object->show_in_menu;
+ else
+ $parent_file = "edit.php?post_type=$post_type";
$submenu_file = "edit.php?post_type=$post_type";
}
break;
default:
- wp_redirect('edit.php');
+ wp_redirect( admin_url('edit.php') );
exit();
break;
} // end switch