get_shortcode_regex

SummerySummery

Retrieve the shortcode regular expression for searching.

Syntax

get_shortcode_regex( array $tagnames = null )

DescriptionDescription

The regular expression combines the shortcode tags in the regular expression in a regex class.

The regular expression contains 6 different sub matches to help with parsing.

1 – An extra [ to allow for escaping shortcodes with double [[]] 2 – The shortcode name 3 – The shortcode argument list 4 – The self closing / 5 – The content of a shortcode when it wraps some content. 6 – An extra ] to allow for escaping shortcodes with double [[]]

ParametersParameters

$tagnames

(array) (Optional) List of shortcodes to find. Defaults to all registered shortcodes.

Default value: null

ReturnReturn

(string) The shortcode search regular expression

SourceSource

File: wp-includes/shortcodes.php


			

ChangelogChangelog

Changelog
Version Description
4.4.0 Added the $tagnames parameter.
2.5.0 Introduced.
Scroll to Top