Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Check if a shortcode exists in WordPress
if ( ! function_exists( 'shortcode_exists' ) ) :
* Check if a shortcode is registered in WordPress.
* Examples: shortcode_exists( 'caption' ) - will return true.
* shortcode_exists( 'blah' ) - will return false.
function shortcode_exists( $shortcode = false ) {
global $shortcode_tags;
if ( ! $shortcode )
return false;
if ( array_key_exists( $shortcode, $shortcode_tags ) )
return true;
return false;

Excellent! Just what I was looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.