shortcode_atts_(shortcode)
Filters shortcode attributes.
If the third parameter of the shortcode_atts() function is present then this filter is available. The third parameter, $shortcode, is the name of the shortcode.
Usage
add_filter( 'shortcode_atts_(shortcode)', 'wp_kama_shortcode_atts_filter', 10, 4 );
/**
* Function for `shortcode_atts_(shortcode)` filter-hook.
*
* @param array $out The output array of shortcode attributes.
* @param array $pairs The supported attributes and their defaults.
* @param array $atts The user defined shortcode attributes.
* @param string $shortcode The shortcode name.
*
* @return array
*/
function wp_kama_shortcode_atts_filter( $out, $pairs, $atts, $shortcode ){
// filter...
return $out;
}
- $out(array)
- The output array of shortcode attributes.
- $pairs(array)
- The supported attributes and their defaults.
- $atts(array)
- The user defined shortcode attributes.
- $shortcode(string)
- The shortcode name.
Changelog
| Since 3.6.0 | Introduced. |
| Since 4.4.0 | Added the $shortcode parameter. |
Where the hook is called
shortcode_atts_(shortcode)
wp-includes/shortcodes.php 690
$out = apply_filters( "shortcode_atts_{$shortcode}", $out, $pairs, $atts, $shortcode );
Where the hook is used in WordPress
wp-includes/widgets/class-wp-widget-custom-html.php 131
add_filter( 'shortcode_atts_gallery', array( $this, '_filter_gallery_shortcode_attrs' ) );
wp-includes/widgets/class-wp-widget-custom-html.php 165
remove_filter( 'shortcode_atts_gallery', array( $this, '_filter_gallery_shortcode_attrs' ) );
wp-includes/widgets/class-wp-widget-text.php 270
add_filter( 'shortcode_atts_gallery', array( $this, '_filter_gallery_shortcode_attrs' ) );
wp-includes/widgets/class-wp-widget-text.php 323
remove_filter( 'shortcode_atts_gallery', array( $this, '_filter_gallery_shortcode_attrs' ) );