get_plugin_page_hookname() - WordPress 函数参考中文文档

返回介绍

get_plugin_page_hookname()

发布于 2017-09-10 字数1730 浏览 905 评论 0

get_plugin_page_hookname( string $plugin_page,  string $parent_page )

描述


参数

$plugin_page

(string)
(Required)

$parent_page

(string)
(Required)


源代码

File: wp-admin/includes/plugin.php

function get_plugin_page_hookname( $plugin_page, $parent_page ) {
	global $admin_page_hooks;

	$parent = get_admin_page_parent( $parent_page );

	$page_type = 'admin';
	if ( empty ( $parent_page ) || 'admin.php' == $parent_page || isset( $admin_page_hooks[$plugin_page] ) ) {
		if ( isset( $admin_page_hooks[$plugin_page] ) ) {
			$page_type = 'toplevel';
		} elseif ( isset( $admin_page_hooks[$parent] )) {
			$page_type = $admin_page_hooks[$parent];
		}
	} elseif ( isset( $admin_page_hooks[$parent] ) ) {
		$page_type = $admin_page_hooks[$parent];
	}

	$plugin_name = preg_replace( '!\.php!', '', $plugin_page );

	return $page_type . '_page_' . $plugin_name;
}

Collapse full 源代码 code

View on Trac


相关函数

Uses

  • wp-admin/includes/plugin.php:
    get_admin_page_parent()

Used By

  • wp-admin/includes/plugin.php:
    get_plugin_page_hook()
  • wp-admin/includes/plugin.php:
    user_can_access_admin_page()
  • wp-admin/includes/plugin.php:
    add_menu_page()
  • wp-admin/includes/plugin.php:
    add_submenu_page()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!