1

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!

1 Answer 1

3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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