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.

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?

Thanks!

share|improve this question
add comment

1 Answer

up vote 1 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
add comment

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.