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

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?

share|improve this question
up vote 0 down vote accepted

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

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.