1

I have registerd a post type called Books in function.php and this post type will display only for editor role. Now when i am login with my dummy editor i am seeing two post type one is Books and second Profile. I want to change default selected Books post type not profile.

What i want: My backed view

My Code:

function codex_custom_init() {
  $labels = array(
    'name' => 'Books',
    'singular_name' => 'Book',
    'add_new' => 'Add New',
    'add_new_item' => 'Add New Book',
    'edit_item' => 'Edit Book',
    'new_item' => 'New Book',
    'all_items' => 'All Books',
    'view_item' => 'View Book',
    'search_items' => 'Search Books',
    'not_found' =>  'No books found',
    'not_found_in_trash' => 'No books found in Trash', 
    'parent_item_colon' => '',
    'menu_name' => 'Books'
  );

  $args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true, 
    'show_in_menu' => true, 
    'query_var' => true,
    'rewrite' => array( 'slug' => 'book' ),
    'capability_type' => 'post',
    'has_archive' => true, 
    'hierarchical' => false,
    'menu_position' => null,
    'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
  ); 

  register_post_type( 'book', $args );
}
add_action( 'init', 'codex_custom_init' );

Any ideas or suggestions? Thanks.

0

Do you mean that when editors log in they should be automatically sent to the Books post type instead of going to the edit profile page?

I believe that by default for user roles that can't access the dashboard they default to the profile upon logging in. If you need to change this there is a plugin called Peter's Login Redirect that can handle this for you.

Once installed you can set up a redirect so that when editors log in they will be sent to whatever URL you set. Simply select the user role and then enter a URL. In your case the URL should be something like this:

/wp-admin/edit.php?post_type=book

|improve this answer|||||
  • Hey bro thanks for giving such great idea, that plugin works for me. Once again thanks :) – Avenger Aug 30 '13 at 16:50
0

Have you tried adjusting and saving the profile for the test editor? Maybe once you've set up your profile it won't default any more.

Also, try setting menu_position to something like 5 instead of null (5 is the standard position in the hierarchy for Posts, so it will still appear above Profile)

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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