Shortcode Already Exists in WordPress

WordPress shortcodes are square bracket strings ([ ]) that magically transform into something fascinating on the frontend. In this tutorial we will see how to check a shortcode which really exists or not.

To check wordpress shortcode exists or not, a function is available in wordpress i.e shortcode_exists().


shortcode_exists( string $tag )

Whether a registered shortcode exists named $tag.


if ( shortcode_exists( 'gallery' ) ) {
    // The  shortcode [gallery] exists.

This function returns boolean value means either true or false. If supplied shortcode exists then returned value will be true otherwise it will be false.

Sanjay KumarHello friends, I am Sanjay Kumar a Web Developer by profession. Additionally I'm also a Blogger, Youtuber by Passion. I founded Online Web Tutor and Skillshike platforms. By using these platforms I am sharing the valuable knowledge of Programming, Tips and Tricks, Programming Standards and more what I have with you all. Read more