wordpress snippets last updated   : January 29, 2015
we now have 646 snippets

Redirect admin pages to any location

wordpress snippet

Redirecting the admin pages was something I needed to do for a recent project. The following snippet will let you redirect any of the admin pages to any location you wish based on the user ‘capability’. Another option would be to replace wp_redirect with wp_die(“some custom message”); to display a message instead of redirecting.

snippet :  PHPcopy
function wps_admin_pages_redirect() {
      global $pagenow;
      $admin_pages = array(

      if(in_array($pagenow, $admin_pages)){
      	wp_redirect( admin_url('/') ); exit;
add_action('admin_init', 'wps_admin_pages_redirect');

Did you like this post? If so please share it with your friends. Thanks!