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
Version Description
2.5.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.