WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/shortcode exists

Description

Checks whether a specific shortcode has been registered or not.

Parameters

$tag
(string) (required) The shortcode to check for.
Default: None

Return

(boolean) 
True if the shortcode has been registered, false otherwise.

Usage

 <?php if ( shortcode_exists'gallery' ) ) { } ?> 

Example

<?php

if ( shortcode_exists( 'gallery' ) ) {
    // The [gallery] short code exists.
}

?>

Change Log

Source File

shortcode_exists() is located in wp-includes/shortcodes.php.

Related

Shortcode API

See also index of Function Reference and index of Template Tags.