admin_page_access_denied WordPress Action Hook

The admin_page_access_denied hook is called when a user is denied access to a WordPress admin page.

do_action( 'admin_page_access_denied' ) #

Fires when access to an admin page is denied.


More Information

admin_page_access_denied is an action hook triggered when an user does not have permission to access a page in the control panel. This is most likely due to not having the required capability to access the page.

The action hook is fired before wp_die is executed, and is a result of the function user_can_access_admin_page returning false.

Top ↑

Basic Examples

function mwb_permission_error() {

  wp_redirect( site_url() );
  exit;

}

add_action( 'admin_page_access_denied', 'mwb_permission_error');

Top ↑

Source

File: wp-admin/includes/menu.php

View on Trac


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.