pre_handle_404
Filters whether to short-circuit default header status handling.
Returning a non-false value from the filter will short-circuit the handling and return early.
Usage
add_filter( 'pre_handle_404', 'wp_kama_pre_handle_404_filter', 10, 2 );
/**
* Function for `pre_handle_404` filter-hook.
*
* @param bool $preempt Whether to short-circuit default header status handling.
* @param WP_Query $wp_query WordPress Query object.
*
* @return bool
*/
function wp_kama_pre_handle_404_filter( $preempt, $wp_query ){
// filter...
return $preempt;
}
- $preempt(true|false)
- Whether to short-circuit default header status handling.
Default: false - $wp_query(WP_Query)
- WordPress Query object.
Changelog
| Since 4.5.0 | Introduced. |
Where the hook is called
pre_handle_404
wp-includes/class-wp.php 738
if ( false !== apply_filters( 'pre_handle_404', false, $wp_query ) ) {