strip_shortcode_tag() WordPress Function

The strip_shortcode_tag() function is used to remove shortcodes from a given string. This is useful for when you want to strip out shortcodes from a string of text, such as when you're displaying an excerpt on a post list page.

strip_shortcode_tag( array $m ) #

Strips a shortcode tag based on RegEx matches against post content.


Parameters

$m

(array)(Required)RegEx matches against post content.


Top ↑

Return

(string|false) The content stripped of the tag, otherwise false.


Top ↑

Source

File: wp-includes/shortcodes.php

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];
}

Top ↑

Changelog

Changelog
VersionDescription
3.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.