Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




redirect_post [ WordPress Function ]

redirect_post ( $post_id = '' )
Parameters:
  • (int) $post_id Optional. Post ID.
Defined at:



Redirect to previous page.

Source


<?php
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'$messageget_edit_post_link$post_id'url' ) );
    } elseif ( isset(
$_POST['addmeta']) && $_POST['addmeta'] ) {
        
$location add_query_arg'message'2wp_get_referer() );
        
$location explode('#'$location);
        
$location $location[0] . '#postcustom';
    } elseif ( isset(
$_POST['deletemeta']) && $_POST['deletemeta'] ) {
        
$location add_query_arg'message'3wp_get_referer() );
        
$location explode('#'$location);
        
$location $location[0] . '#postcustom';
    } elseif ( 
'post-quickpress-save-cont' == $_POST['action'] ) {
        
$location "post.php?action=edit&post=$post_id&message=7";
    } else {
        
$location add_query_arg'message'4get_edit_post_link$post_id'url' ) );
    }

    
wp_redirectapply_filters'redirect_post_location'$location$post_id ) );
    exit;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics