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
檢視更多 >