settingsAccountsettings
By using our mini forum, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy
Menusettings

Q: How to hide WordPress plugin in my WP dashboard?

+5 votes

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

asked in Web Development category by user icabe

1 Answer

+4 votes

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');

You can also see this answer if you want to hide the WordPress plugin from the menu area in your dashboard.

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');
answered by user john7
edited by user golearnweb
...