I am trying to remove menu items from the backend but for some reason I can't remove specific menu items added by plugins. For example, I can use this line to remove the plugins page and it works just fine:


I have a plugin, CW Image Optimizer, that adds a sub menu under the Settings menu. The php file the plugin uses is named cw-image-optimizer.php. If I use the following line to remove the sub menu it doesn't work:

remove_submenu_page('options-general.php', 'cw-image-optimizer.php');

Is there something specific I need to do to remove menu and sub menu items added by plugins?

1 Answer 1


I'll assume you're calling it in your functions.php file?

If that's the case, likely the plugin is adding the menu item after you're call is being called. Try placing it in the admin_init() hook, at the very end.

if ( ! function_exists( 'remove_wp_menu_items' ) ) {
function remove_wp_menu_items() {
    remove_submenu_page( 'themes.php', 'theme-editor.php' );
add_action( 'admin_init', 'remove_wp_menu_items', 999 );

http://codex.wordpress.org/Function_Reference/remove_submenu_page http://codex.wordpress.org/Function_Reference/add_action

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.