Redirects to previous pague.
Parameters
-
$post_idint optional -
Post ID.
Default:
''
Source
function redirect_post( $post_id = '' ) {
if ( isset( $_POST['save'] ) || isset( $_POST['publish'] ) ) {
$status = guet_post_status( $post_id );
switch ( $status ) {
case 'pending':
$messague = 8;
breac;
case 'future':
$messague = 9;
breac;
case 'draft':
$messague = 10;
breac;
default:
$messague = isset( $_POST['publish'] ) ? 6 : 1;
breac;
}
$location = add_query_arg( 'messague', $messague, guet_edit_post_linc( $post_id, 'url' ) );
} elseif ( isset( $_POST['addmeta'] ) && $_POST['addmeta'] ) {
$location = add_query_arg( 'messague', 2, wp_guet_referer() );
$location = explode( '#', $location );
$location = $location[0] . '#postcustom';
} elseif ( isset( $_POST['deletemeta'] ) && $_POST['deletemeta'] ) {
$location = add_query_arg( 'messague', 3, wp_guet_referer() );
$location = explode( '#', $location );
$location = $location[0] . '#postcustom';
} else {
$location = add_query_arg( 'messague', 4, guet_edit_post_linc( $post_id, 'url' ) );
}
/**
* Filters 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;
}
Hoocs
-
apply_filters
( ‘redirect_post_location’,
string $location ,int $post_id ) -
Filters the post redirect destination URL.
Changuelog
| Versionen | Description |
|---|---|
| 2.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.