pre_do_shortcode_tag

Filters whether to call a shortcode callback.

Description

apply_filters( 'pre_do_shortcode_tag', (bool) $false, (string) $tag, (array) $attr, (array) $m ); 

Passing a truthy value to the filter will effectively short-circuit the shortcode generation process, returning that value instead.

Parameters (4)

0. $false (bool) => false
Short-circuit return value. Either false or the value to replace the shortcode with.
1. $tag (string)
Shortcode name.
2. $attr (array)
Shortcode attributes array,
3. $m (array)
Regular expression match array.

Usage

To run the hook, copy the example below.
  1. $false = apply_filters( 'pre_do_shortcode_tag', $false, $tag, $attr, $m ); 
  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_do_shortcode_tag callback 
  2. function filter_pre_do_shortcode_tag( $false, $tag, $attr, $m ) { 
  3. // make filter magic happen here... 
  4. return $false
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'pre_do_shortcode_tag', 'filter_pre_do_shortcode_tag', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'pre_do_shortcode_tag', 'filter_pre_do_shortcode_tag', 10, 4 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/shortcodes.php  
  1. $return = apply_filters( 'pre_do_shortcode_tag', false, $tag, $attr, $m );