pre_do_shortcode_tag
Filter HookDescription
Filters whether to call a shortcode callback. Returning a non-false value from filter will short-circuit the shortcode generation process, returning that value instead.Hook Information
File Location |
wp-includes/shortcodes.php
View on GitHub
|
Hook Type | Filter |
Line Number | 427 |
Hook Parameters
Type | Name | Description |
---|---|---|
false|string
|
$output
|
Short-circuit return value. Either false or the value to replace the shortcode with. |
string
|
$tag
|
Shortcode name. |
array
|
$attr
|
Shortcode attributes array, can be empty if the original arguments string cannot be parsed. |
array
|
$m
|
Regular expression match array. |
Usage Examples
Basic Usage
<?php
// Hook into pre_do_shortcode_tag
add_filter('pre_do_shortcode_tag', 'my_custom_filter', 10, 4);
function my_custom_filter($output, $tag, $attr, $m) {
// Your custom filtering logic here
return $output;
}
Source Code Context
wp-includes/shortcodes.php:427
- How this hook is used in WordPress core
<?php
422 * @param false|string $output Short-circuit return value. Either false or the value to replace the shortcode with.
423 * @param string $tag Shortcode name.
424 * @param array $attr Shortcode attributes array, can be empty if the original arguments string cannot be parsed.
425 * @param array $m Regular expression match array.
426 */
427 $return = apply_filters( 'pre_do_shortcode_tag', false, $tag, $attr, $m );
428 if ( false !== $return ) {
429 return $return;
430 }
431
432 $content = isset( $m[5] ) ? $m[5] : null;
PHP Documentation
<?php
/**
* Filters whether to call a shortcode callback.
*
* Returning a non-false value from filter will short-circuit the
* shortcode generation process, returning that value instead.
*
* @since 4.7.0
* @since 6.5.0 The `$attr` parameter is always an array.
*
* @param false|string $output Short-circuit return value. Either false or the value to replace the shortcode with.
* @param string $tag Shortcode name.
* @param array $attr Shortcode attributes array, can be empty if the original arguments string cannot be parsed.
* @param array $m Regular expression match array.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/shortcodes.php
Related Hooks
Related hooks will be displayed here in future updates.