简体   繁体   中英

How to get rid of submenu tooltips?

When hovering over an menu item with submenu pages in the wordpress backend a "tooltip" showing each submenu page is popping up.

How can I get rid of these?

在此处输入图片说明

What I've tried so far: Removing the wp-has-submenu style class. This works - kinda. When hovering the tooltip doesnt appear anymore. On mousedown on an item the tooltip still appears.

    $('#adminmenu').children('li').each(function () {
        $(this).removeClass('wp-has-submenu');
    // removing or changing the value of the 'aria-haspopup' attr doesn't solve the problem. Not sure what the attr is for
    //  $(this).children('a').each(function(){
    //      $(this).attr('aria-haspopup', 'false');
    //  });
    });

Update1

Well okay this seems to be pure javascript and no jQuery. I've removed any event bindings from any element. Still showing tooltips.

    $('html').find("*").each(function () {
        $(this).off();
        $(this).unbind();
    });

AFAIK and a short google you can't remove pure js event handlers without a reference to the actual handler.

Update2

Hmm looking through /wp-admin/js/ it seems everything or at least very much is done in jQuery.. So.. I'm running out of ideas

Update3

After searching/looking and editing a lot of .js files I decided to delete /wp-admin/js and /wp-includes/js . IT IS STILL APPEARING. Holy .. what the heck are they doin.

Update 4

This seems to work

.js #adminmenu .opensub .wp-submenu {
    display:none !important;
}


Yes,your code is working now. But I 'm describing here a simple way for adding this code in our theme and it will remove the hover effect in admin section.
Follow the steps.

Step-1: add this code in functions.php file of your theme.
function theme_name_scripts() { wp_enqueue_style( 'admin-hovermenu', get_template_directory_uri() ."/admin.css" ); }add_action( 'admin_enqueue_scripts', 'theme_name_scripts' );
Step:2 Create a file named admin.css and add this line in that file.
.js #adminmenu .opensub .wp-submenu { display:none !important; }
Now it will works.If need anything else then please let me know.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM