Skip to content

@r-a-y /shortcode.php
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Check if a shortcode exists in WordPress
<?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;
?>
@Vitzkrieg

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.