Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In my theme functions.php i get code:

    add_action( 'admin_init', 'my_remove_menu_pages' );
function my_remove_menu_pages() {
if(!current_user_can('delete_others_posts')) {
remove_menu_page('edit.php?post_type=page');
remove_menu_page('edit-comments.php');
remove_menu_page('edit.php?post_type=slide');
}
}

but then in role Author user can't edit images for thumbnail - he gives info:

    Invalid argument supplied for foreach() in /wp-admin/includes/plugin.php on line 1286

Could anyone tell me what's wrong?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I'll guess that admin_init is too early for remove_menu_page, the hook should be admin_menu.

share|improve this answer
    
Thanks a lot! Now it works properly:) –  Marcin Nov 17 '12 at 14:24

Your Answer

 
discard

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.