WordPress.org

Forums

[resolved] How to remove theme editor submenu? (6 posts)

  1. mingya
    Member
    Posted 4 years ago #

    Anyone knows how to remove theme editor from admin menu (WordPress 3.0.4)?

    Previously it has a submenu hook [10] for theme.php, but now it's being added to the menu using the following inside /wp-admin/menu.php:

    add_action('admin_menu', '_add_themes_utility_last', 101);

    Tried using remove_action, but doesn't work.

    Please help.

  2. iKindred
    Member
    Posted 4 years ago #

    Try this within a plugin or functions file:

    add_action('admin_menu', 'my_remove_menu_elements', 102);
    
    function my_remove_menu_elements()
    {
    	remove_submenu_page( 'themes.php', 'theme-editor.php' );
    }
  3. bristweb
    Member
    Posted 3 years ago #

    it seems as of the latest update to the admin gui the
    remove_submenu_page( 'themes.php', 'theme-editor.php' );
    does not work. however
    remove_submenu_page('plugins.php', 'plugin-editor.php' );
    does work

    any idea what changed?

  4. therealwesfoster
    Member
    Posted 3 years ago #

    You need to call that action in admin_init, not admin_menu

    So:

    add_action('admin_init', 'my_remove_menu_elements', 102);
    
    function my_remove_menu_elements()
    {
    	remove_submenu_page( 'themes.php', 'theme-editor.php' );
    }

    :)

  5. bristweb
    Member
    Posted 3 years ago #

    You need to call that action in admin_init, not admin_menu

    answer

    THANK YOU!

  6. therealwesfoster
    Member
    Posted 3 years ago #

    No problem, glad to help. Be sure to mark this post as "solved" so it can help others with this problem.

Topic Closed

This topic has been closed to new replies.

About this Topic