[Solved] How to hide WordPress plugin in my WP dashboard?

  

3
Topic starter

I would like to hide a plugin in the plugin area of my WordPress admin area (dashboard);

How can I do it with code implemented in the functions.php file?

Here is an example:

how to hide plugin in the wordpress plugin area

Maybe I can use some CSS and display: none property??

Thanks

1 Answer
2

You can use WP hook admin_head and the CSS property display:none;

Just paste the code below in your functions.php file

Here is the code:

/* Hide plugin in WordPress dashboard area */
function hidePlugin() {
    echo '<style>
    .plugins-php .plugins tr[data-slug="aryo-activity-log"]{ display:none; }
</style>';
}
 
add_action('admin_head', 'hidePlugin');

Here is another article on this topic.


Also, if you want particular user (in my case administrator with id=1) NOT TO BE ABLE to see the plugin, here is the code (see line #3):

/* Hide plugin in WordPress dashboard area */
function hidePlugin() {
    if (get_current_user_id() == 1) {
        echo '<style>
    .plugins-php .plugins tr[data-slug="aryo-activity-log"]{ display:none; }
</style>';
    }
}
 
add_action('admin_head', 'hidePlugin');
Share: