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对文章内容的匹配,剥离一个短码标签。

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
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 18:32:58

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: