How to Check if Shortcode already Exist in WordPress

Luckily, In WordPress 3.6.0, they have introduced a new function that will allow us to check the existence of shortcodes.

By using shortcode_exists($shortcode_tag), A function that can easily check if any shortcode already available in WordPress or not.

Eg: Let’s check for the default [gallery] shortcode that comes with WordPress.

		echo "shortcode already exist";	
		echo "shortcode not found";

You can also check the existence of custom build shortcodes as well. All you need to do is just pass the shortcode tag in the function as parameter. Something like given below

        shortcode_exists( 'my_custom_shortcode_name' )

You can also check, Get a list of all the active shortcodes in WordPress

Share it to the Community!

You May Also Like These shortcode Posts: