WPDev.one
Core Function
View Source on Trac ↗

add_shortcode()

add_shortcode( mixed $tag, mixed $callback )

Adds a new shortcode.

Parameters 2 required

Name / Type Description
$tag
string

Shortcode tag to be searched in post content.

Required
callable

$callback The callback function to run when the shortcode is found. Every shortcode callback is passed three parameters by default, including an array of attributes (`$atts`), the shortcode content or null if not set (`$content`), and finally the shortcode tag itself (`$shortcode_tag`), in that order.

Required

Return Value

(void)
No return value description available.

Function Information

Since Version
2.5.0
Source File
wp-includes/shortcodes.php
Advertisement