函数文档

is_plugin_page()

💡 云策文档标注

概述

is_plugin_page() 函数用于判断当前管理页面是否由插件生成,但自 WordPress 3.1.0 起已被弃用。开发者应避免使用此函数,转而依赖全局变量 $plugin_page 或 get_plugin_page_hookname() 钩子。

关键要点

  • 函数 is_plugin_page() 检查全局变量 $plugin_page 是否设置,以确定页面是否由插件生成。
  • 该函数在 WordPress 3.1.0 版本中被标记为弃用,建议使用替代方法。
  • 相关资源包括 Conditional Tags 文章和 _deprecated_function() 函数。

注意事项

由于函数已弃用,新开发中不应使用 is_plugin_page(),以避免兼容性问题。应参考 Theme Developer Handbook 中的条件标签指南。


📄 原文内容

Determines whether the current admin page is generated by a plugin.

Description

Use global $plugin_page and/or get_plugin_page_hookname() hooks.

For more information on this and similar theme functions, check out the Conditional Tags article in the Theme Developer Handbook.

Return

bool

Source

function is_plugin_page() {
	_deprecated_function( __FUNCTION__, '3.1.0' );

	global $plugin_page;

	if ( isset($plugin_page) )
		return true;

	return false;
}

Changelog

Version Description
3.1.0 Deprecated.
1.5.0 Introduced.