shortcode_exists() – Function | Developer.WordPress.org

Determines whether a registered shortcode exists named $tag.

Parameters

$tagstringrequired

Shortcode tag to check.

Return

bool Whether the given shortcode exists.

Source

function shortcode_exists( $tag ) {
	global $shortcode_tags;
	return array_key_exists( $tag, $shortcode_tags );
}

View all references View on Trac View on GitHub

Used byDescription
has_shortcode()wp-includes/shortcodes.php

Determines whether the passed content contains the specified shortcode.

Changelog

VersionDescription
3.6.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    Basic Example

    <?php
    
    if ( shortcode_exists( 'gallery' ) ) {
        // The  short code exists.
    }
    
    ?>