pre_handle_404
Filters whether to short-circuit default header status handling.
Description
Returning a non-false value from the filter will short-circuit the handling and return early.
Parameters (2)
- 0. $false (bool) =>
false
- Whether to short-circuit default header status handling. Default false.
- 1. $wp_query (WP_Query)
- WordPress Query object.
Usage
- To run the hook, copy the example below.
- $false = apply_filters( 'pre_handle_404', $false, $wp_query );
- if ( !empty( $false ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the pre_handle_404 callback
- function filter_pre_handle_404( $false, $wp_query ) {
- // make filter magic happen here...
- return $false;
- };
- // add the filter
- add_filter( 'pre_handle_404', 'filter_pre_handle_404', 10, 2 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'pre_handle_404', 'filter_pre_handle_404', 10, 2 );
Defined (1)
The filter is defined in the following location(s).
- /wp-includes/class-wp.php
- if ( false !== apply_filters( 'pre_handle_404', false, $wp_query ) ) {