0

I wonder how you can list specific shortcodes, for example with this code you get a list of all active shortcode tags:

<?php 

global $shortcode_tags;

echo '<pre>'; print_r($shortcode_tags); echo '</pre>';

?>

I want to create a statement to get specific shortcodes tags for example:

we want a list of all shortcodes [hello]

if ($shortcode_tags==[hello]) {

echo '<pre>'; print_r($shortcode_tags[hello]); echo '</pre>';

}

Any suggest; thank you

0

The conditional needs to test against strings which would be the name of the shortcode. If you're looking for the [hello] shortcode the conditional would look like:

echo '<pre>'; print_r( $shortcode_tags['hello'] ); echo '</pre>';

So if you use add_shortcode() the string you'll be looking for is the first parameter: $tag.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.