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

Using the the remove_menu_page function results in a really strange bug. By adding the code below in the functions.php file the integrated "Add media" widget starts to bug.

function remove_menu_pages() {

    // Remove admin menu pages that are not used
    remove_menu_page( 'link-manager.php' );
    remove_menu_page( 'tools.php' );
add_action( 'admin_init', 'remove_menu_pages' );

When clicking "Add Media" while editing a post no files will show up under "Media Library", even tough the Media Library has plenty of files uploaded to it. If you try to upload a file, it will show up, but you won't be able to insert it into the WYSIWYG editor. If you close the "Add Media" window and then open it again the file is gone (but it's there if you navigate to the media library in the main navigation).

Have anyone experienced this? Can anyone replicate it?


share|improve this question
up vote 3 down vote accepted

It's because you've hooked it to the wrong action, it should be admin_menu, not admin_init.

share|improve this answer

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.