Filter hook 'redirect_post_location'

in WP Core File wp-admin/includes/post.php at line 2229

View Source

redirect_post_location

Filter Hook
Description
Filters the post redirect destination URL.

Hook Information

File Location wp-admin/includes/post.php View on GitHub
Hook Type Filter
Line Number 2229

Hook Parameters

Type Name Description
string $location The destination URL.
int $post_id The post ID.

Usage Examples

Basic Usage
<?php
// Hook into redirect_post_location
add_filter('redirect_post_location', 'my_custom_filter', 10, 2);

function my_custom_filter($location, $post_id) {
    // Your custom filtering logic here
    return $location;
}

Source Code Context

wp-admin/includes/post.php:2229 - How this hook is used in WordPress core
<?php
2224  	 * @since 2.9.0
2225  	 *
2226  	 * @param string $location The destination URL.
2227  	 * @param int    $post_id  The post ID.
2228  	 */
2229  	wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
2230  	exit;
2231  }
2232  
2233  /**
2234   * Sanitizes POST values from a checkbox taxonomy metabox.

PHP Documentation

<?php
/**
	 * Filters the post redirect destination URL.
	 *
	 * @since 2.9.0
	 *
	 * @param string $location The destination URL.
	 * @param int    $post_id  The post ID.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-admin/includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.