Make has_shortcode() recursive/work for nested shortcodes.

Adds unit test.

Props katzwebdesign.
Fixes #26343.

Built from https://develop.svn.wordpress.org/trunk@29197


git-svn-id: http://core.svn.wordpress.org/trunk@28981 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-07-16 22:05:17 +00:00
parent cf3deb2ecb
commit 1292ee0151

View File

@ -165,8 +165,11 @@ function has_shortcode( $content, $tag ) {
return false;
foreach ( $matches as $shortcode ) {
if ( $tag === $shortcode[2] )
if ( $tag === $shortcode[2] ) {
return true;
} elseif ( isset( $shortcode[5] ) && has_shortcode( $shortcode[5], $tag ) ) {
return has_shortcode( $shortcode[5], $tag );
}
}
}
return false;