3
07/11/2024 7:48 am
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:
Maybe I can use some CSS and display: none property??
Thanks
1 Answer
2
07/11/2024 7:50 am
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');