pre_handle_404

Filters whether to short-circuit default header status handling.

Description

apply_filters( 'pre_handle_404', (bool) $false, (WP_Query) $wp_query ); 

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.
  1. $false = apply_filters( 'pre_handle_404', $false, $wp_query ); 
  2.  
  3. if ( !empty( $false ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the pre_handle_404 callback 
  2. function filter_pre_handle_404( $false, $wp_query ) { 
  3. // make filter magic happen here... 
  4. return $false
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'pre_handle_404', 'filter_pre_handle_404', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. 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  
  1. if ( false !== apply_filters( 'pre_handle_404', false, $wp_query ) ) {