WordPress.org

Ready to get started?Download WordPress

Codex

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

Function Reference/shortcode exists

Description

Checks whether a specific short code exists.

Parameters

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

Return

(Bool) 
True if the short code 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.