函数文档

remove_all_shortcodes()

💡 云策文档标注

概述

remove_all_shortcodes() 函数用于清除所有已注册的短代码标签,通过将全局变量 $shortcode_tags 替换为空数组来实现高效移除。

关键要点

  • 函数清除所有短代码标签,重置 $shortcode_tags 全局变量为空数组
  • 这是一种高效移除所有短代码的方法,适用于需要临时禁用或重置短代码的场景
  • 函数自 WordPress 2.5.0 版本引入,无参数和返回值

代码示例

function remove_all_shortcodes() {
	global $shortcode_tags;

	$shortcode_tags = array();
}

注意事项

使用此函数会永久移除所有短代码,直到重新注册;需谨慎操作,避免影响其他插件或主题功能。


📄 原文内容

Clears all shortcodes.

Description

This function clears all of the shortcode tags by replacing the shortcodes global with an empty array. This is actually an efficient method for removing all shortcodes.

Source

function remove_all_shortcodes() {
	global $shortcode_tags;

	$shortcode_tags = array();
}

Changelog

Version Description
2.5.0 Introduced.