WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created custom post type Books in my functions.php. Now I want to redirect every user (assigned with editor role). When they click to Dashboard it goes to this page:


What I want:

enter image description here

share|improve this question
up vote 2 down vote accepted
add_action('load-index.php', 'redirect_dashboard');

function redirect_dashboard() {
  if ( ! is_admin() || current_user_can('activate_plugins') ) return;
  $screen = get_current_screen();
  if ( is_object($screen) && $screen->base == 'dashboard' ) {
    $url = admin_url('edit.php');
    wp_safe_redirect( add_query_arg( array('post_type' => 'product'), $url) );
share|improve this answer
It is also affecting to main administrator page. I want only editor role otherwise you code is perfect for me. Can you help me how to fix that also. – Avenger Aug 31 '13 at 2:03
@Manan I've edited the code. Just a little addition on first if. In the question you said "i want to redirect every user" not "i want to redirect every editor" or I would use this code on first publish. – gmazzap Aug 31 '13 at 2:14
Thank you G. M. :) – Avenger Sep 1 '13 at 5:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.