Skip to content

Instantly share code, notes, and snippets.

@ataylorme
Forked from r-a-y/shortcode.php
Created April 29, 2013 16:12
Show Gist options
  • Save ataylorme/5482647 to your computer and use it in GitHub Desktop.
Save ataylorme/5482647 to your computer and use it in GitHub Desktop.
<?php
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;
}
endif;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment