mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Add shortcode_atts_$shortcode filter for when the name of the shortcode is passed to shortcode_atts(). props coffee2code. fixes #15155.
git-svn-id: https://develop.svn.wordpress.org/trunk@23626 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user