strip_shortcode_tag

函数
strip_shortcode_tag ( $m )
参数
  • (array) $m RegEx matches against post content.
    Required:
返回值
  • (string|false) The content stripped of the tag, otherwise false.
定义位置
相关方法
strip_shortcodesdo_shortcode_taghas_shortcodeget_shortcode_regexshortcode_atts
引入
3.3.0
弃用
-

strip_shortcode_tag: 这是一个WordPress的函数,从一个字符串中删除一个短码标签。它需要两个参数,$content和$tag。参数$content是包含短码标签的字符串。$tag参数是要删除的短码标签的名称。它返回删除指定的短码标签的字符串。

根据RegEx对文章内容的匹配,剥离一个短码标签。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function strip_shortcode_tag( $m ) {
// Allow [[foo]] syntax for escaping a tag.
if ( '[' === $m[1] && ']' === $m[6] ) {
return substr( $m[0], 1, -1 );
}
return $m[1] . $m[6];
}
function strip_shortcode_tag( $m ) { // Allow [[foo]] syntax for escaping a tag. if ( '[' === $m[1] && ']' === $m[6] ) { return substr( $m[0], 1, -1 ); } return $m[1] . $m[6]; }
function strip_shortcode_tag( $m ) {
	// Allow [[foo]] syntax for escaping a tag.
	if ( '[' === $m[1] && ']' === $m[6] ) {
		return substr( $m[0], 1, -1 );
	}

	return $m[1] . $m[6];
}

常见问题

FAQs
查看更多 >