Make WordPress Core


Ignore:
Timestamp:
09/10/2015 09:30:24 PM (11 years ago)
Author:
wonderboymusic
Message:

Move redirect_post() from wp-admin/post.php to wp-admin/includes/post.php.

See #33813.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/post.php

    r33542 r34020  
    3939}
    4040
    41 /**
    42  * Redirect to previous page.
    43  *
    44  * @param int $post_id Optional. Post ID.
    45  */
    46 function redirect_post($post_id = '') {
    47     if ( isset($_POST['save']) || isset($_POST['publish']) ) {
    48         $status = get_post_status( $post_id );
    49 
    50         if ( isset( $_POST['publish'] ) ) {
    51             switch ( $status ) {
    52                 case 'pending':
    53                     $message = 8;
    54                     break;
    55                 case 'future':
    56                     $message = 9;
    57                     break;
    58                 default:
    59                     $message = 6;
    60             }
    61         } else {
    62             $message = 'draft' == $status ? 10 : 1;
    63         }
    64 
    65         $location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) );
    66     } elseif ( isset($_POST['addmeta']) && $_POST['addmeta'] ) {
    67         $location = add_query_arg( 'message', 2, wp_get_referer() );
    68         $location = explode('#', $location);
    69         $location = $location[0] . '#postcustom';
    70     } elseif ( isset($_POST['deletemeta']) && $_POST['deletemeta'] ) {
    71         $location = add_query_arg( 'message', 3, wp_get_referer() );
    72         $location = explode('#', $location);
    73         $location = $location[0] . '#postcustom';
    74     } else {
    75         $location = add_query_arg( 'message', 4, get_edit_post_link( $post_id, 'url' ) );
    76     }
    77 
    78     /**
    79      * Filter the post redirect destination URL.
    80      *
    81      * @since 2.9.0
    82      *
    83      * @param string $location The destination URL.
    84      * @param int    $post_id  The post ID.
    85      */
    86     wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
    87     exit;
    88 }
    89 
    9041if ( isset( $_POST['deletepost'] ) )
    9142    $action = 'delete';
Note: See TracChangeset for help on using the changeset viewer.