do_shortcode_tag()
do_shortcode_tag( array $m ) 用于调用shortcode hook的dou sho…
do_shortcode_tag( array $m )
用于调用shortcode hook的dou shortcode()可调用的正则表达式。
Regular Expression callable for do_shortcode() for calling shortcode hook.
用于调用shortcode hook的dou shortcode()可调用的正则表达式。
Regular Expression callable for do_shortcode() for calling shortcode hook.
目录锚点:#说明#参数#返回#源码
说明(Description)
另见函数 https://www.wp2.cn/functions()
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| $m | (array) | 必需 | 正则表达式匹配数组 |
返回(Return)
(string|false)失败时为false。
源码(Source)
/**
* Regular Expression callable for do_shortcode() for calling shortcode hook.
* @see get_shortcode_regex for details of the match array contents.
*
* @since 2.5.0
* @access private
*
* @global array $shortcode_tags
*
* @param array $m Regular expression match array
* @return string|false False on failure.
*/
function do_shortcode_tag( $m ) {
global $shortcode_tags;
// allow [[foo]] syntax for escaping a tag
if ( $m[1] == '[' && $m[6] == ']' ) {
return substr($m[0], 1, -1);
}
$tag = $m[2];
$attr = shortcode_parse_atts( $m[3] );
if ( ! is_callable( $shortcode_tags[ $tag ] ) ) {
$message = sprintf( __( 'Attempting to parse a shortcode without a valid callback: %s' ), $tag );
_doing_it_wrong( __FUNCTION__, $message, '4.3.0' );
return $m[0];
}
if ( isset( $m[5] ) ) {
// enclosing tag - extra parameter
return $m[1] . call_user_func( $shortcode_tags[$tag], $attr, $m[5], $tag ) . $m[6];
} else {
// self-closing tag
return $m[1] . call_user_func( $shortcode_tags[$tag], $attr, null, $tag ) . $m[6];
}
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.5.0 | wp-includes/shortcodes.php:305 | 1 function | 6 |
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

还没有任何评论,赶紧来占个楼吧!