remove_all_shortcodes() WordPress Function

If you're ever working with shortcodes in WordPress and want to remove them all at once, the remove_all_shortcodes() function is your friend. This function will strip out all shortcodes from your content, leaving behind only the content that is not wrapped in a shortcode.

remove_all_shortcodes() #

Clear all shortcodes.


Description

This function is simple, it clears all of the shortcode tags by replacing the shortcodes global by a empty array. This is actually a very efficient method for removing all shortcodes.


Top ↑

Source

File: wp-includes/shortcodes.php

function remove_all_shortcodes() {
	global $shortcode_tags;

	$shortcode_tags = array();
}


Top ↑

Changelog

Changelog
VersionDescription
2.5.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.