简体   繁体   中英

Wordpress hide plugin from everywhere

I am using this code in function.php

function wpdocs_enqueue_custom_admin_style() {
        wp_register_style( 'custom_wp_admin_css', get_template_directory_uri() . '/admin-style.css', false, '1.0.0' );
        wp_enqueue_style( 'custom_wp_admin_css' );
}
add_action( 'admin_enqueue_scripts', 'wpdocs_enqueue_custom_admin_style' );

It works on Admin dashboard, but when I Visit Site from dashboard, that plugin appears on the home page of website.

How can I hide it from everywhere?

I have also tried:

function admin_style() {
  echo '<style>
    li#wp-admin-bar-wpseo-menu.menupop {
      display: none;
      visibility: hidden;
    }
  </style>';
}
add_action('admin_head', 'admin_style');

Still no luck!

You can do this without the code. Firstly you have to go user page. After that you have to open the current user settings. You can see toolbar checkbox setting. If you want do that with code you can use that:

/* Disable WordPress Admin Bar for all users */
add_filter( 'show_admin_bar', '__return_false' );

And you can try this:

<?php
  function hook_css() {
 ?>
    <style>
   li#wp-admin-bar-wpseo-menu.menupop {
         display: none;
          visibility: hidden;
         }
     </style>
<?php
}
add_action('wp_head', 'hook_css');

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