shortcode_exists( string $tag )
Whether a registered shortcode exists named $tag
Description Description
Parameters Parameters
- $tag
-
(string) (Required) Shortcode tag to check.
Return Return
(bool) Whether the given shortcode exists.
Source Source
File: wp-includes/shortcodes.php
function shortcode_exists( $tag ) {
global $shortcode_tags;
return array_key_exists( $tag, $shortcode_tags );
}
Expand full source code Collapse full source code View on Trac
Changelog Changelog
| Version | Description |
|---|---|
| 3.6.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Basic Example
<?php if ( shortcode_exists( 'gallery' ) ) { // The short code exists. } ?>