WordPress.org

Ready to get started?Download WordPress

Codex

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

Difference between revisions of "Function Reference/shortcode exists"

(Example)
(Source File: add filename)
Line 27: Line 27:
 
== Source File ==
 
== Source File ==
 
<!-- Need links to current source code files -->
 
<!-- Need links to current source code files -->
<tt>shortcode_exists()</tt> is located in {{Trac|wp-whatever/file.php}}.
+
<tt>shortcode_exists()</tt> is located in {{Trac|wp-includes/shortcodes.php}}.
   
 
== Related ==
 
== Related ==

Revision as of 19:35, 17 May 2013

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.