The linked question shows you how to get all the shortcode tags in an array. So narrowing them down to specific ones is purely a PHP question. But the answer’s simple enough.
Use array_filter()
on the array of tags with a callback function that uses strpos()
to see if each tag contains the work you’re looking for. Since the shortcode tag is the key in the array, use ARRAY_FILTER_USE_KEY
to use the actual shortcode tag for the comparison in the callback function:
global $shortcode_tags;
$shortcodes = array_filter(
$shortcode_tags,
function( $shortcode_tag ) {
return strpos( $shortcode_tag, 'woocommerce' ) !== false;
},
ARRAY_FILTER_USE_KEY
);
In that example $shortcodes
will now be all the shortcodes from global $shortcode_tags;
that contain the word “woocommerce”.