diff --git a/wp-includes/media.php b/wp-includes/media.php index f1f373735e..c543389a97 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -644,7 +644,7 @@ function img_caption_shortcode($attr, $content = null) { 'align' => 'alignnone', 'width' => '', 'caption' => '' - ), $attr)); + ), $attr, 'caption')); if ( 1 > (int) $width || empty($caption) ) return $content; @@ -704,7 +704,7 @@ function gallery_shortcode($attr) { 'size' => 'thumbnail', 'include' => '', 'exclude' => '' - ), $attr)); + ), $attr, 'gallery')); $id = intval($id); if ( 'RAND' == $order ) diff --git a/wp-includes/shortcodes.php b/wp-includes/shortcodes.php index 2dfc277450..bdc3f9bd56 100644 --- a/wp-includes/shortcodes.php +++ b/wp-includes/shortcodes.php @@ -289,9 +289,10 @@ function shortcode_parse_atts($text) { * * @param array $pairs Entire list of supported attributes and their defaults. * @param array $atts User defined attributes in shortcode tag. + * @param string $shortcode Optional. The name of the shortcode, provided for context to enable filtering * @return array Combined and filtered attribute list. */ -function shortcode_atts($pairs, $atts) { +function shortcode_atts( $pairs, $atts, $shortcode = '' ) { $atts = (array)$atts; $out = array(); foreach($pairs as $name => $default) { @@ -300,6 +301,10 @@ function shortcode_atts($pairs, $atts) { else $out[$name] = $default; } + + if ( $shortcode ) + $out = apply_filters( "shortcode_atts_{$shortcode}", $out, $pairs, $atts ); + return $out; }