add_shortcode ( $tag, $callback )

  • (string) $tag Shortcode tag to be searched in post content.
  • (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.
Defined at:


Adds a new shortcode.

Care should be taken through prefixing or other means to ensure that the shortcode tag being added is unique and will not conflict with other, already-added shortcode tags. In the event of a duplicated tag, the tag loaded last will take precedence.

Related Functions

do_shortcode, has_shortcode, wp_audio_shortcode, do_shortcode_tag, gallery_shortcode

Top Google Results

User discussions

wpseek mobile