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

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')) {

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
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


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.