get_shortcode_regex()获取短标签的正则表达式

目录

描述

Returns regular expression used to search for shortcodes inside posts.

This function combines all registered shortcode tags into a single regular expression.

get_shortcode_regex() 描述

用法

This can only be used when $post is available. 'wp' is the earliest action you can hook into to get access to it.

Note: The example that previously appeared on this page used preg_match() instead of preg_match_all(), so it only detected the first shortcode used on the page. You should update any code that uses that example with the current example in order to fix that bug.

The following code is an adjustment of the first example, but able to also search all posts on the index page.

get_shortcode_regex() 用法

参数

None

get_shortcode_regex() 参数

返回值

(string

The shortcode search regular expression.

get_shortcode_regex() 返回值

历史

添加于 版本: 2.5

get_shortcode_regex() 历史

源文件

get_shortcode_regex() 函数的代码位于 wp-includes/shortcodes.php.

get_shortcode_regex() 源文件

相关