get_plugin_page_hook() WordPress Function

The get_plugin_page_hook() function is used to get the hook suffix for a plugin page. This is useful for plugin developers who need to add their own custom pages to the WordPress admin.

get_plugin_page_hook( string $plugin_page, string $parent_page ) #

Gets the hook attached to the administrative page of a plugin.


Parameters

$plugin_page

(string)(Required)The slug name of the plugin page.

$parent_page

(string)(Required)The slug name for the parent menu (or the file name of a standard WordPress admin page).


Top ↑

Return

(string|null) Hook attached to the plugin page, null otherwise.


Top ↑

Source

File: wp-admin/includes/plugin.php

function get_plugin_page_hook( $plugin_page, $parent_page ) {
	$hook = get_plugin_page_hookname( $plugin_page, $parent_page );
	if ( has_action( $hook ) ) {
		return $hook;
	} else {
		return null;
	}
}


Top ↑

Changelog

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