Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FrancoStino/cb59bb46df6b39a0215cbfcb45c4676d to your computer and use it in GitHub Desktop.
Save FrancoStino/cb59bb46df6b39a0215cbfcb45c4676d to your computer and use it in GitHub Desktop.
Hide plugins from the WordPress Admin plugin list
<?php
add_filter(
'all_plugins',
function ( $plugins ) {
$shouldHide = ! array_key_exists( 'show_all', $_GET );
if ( $shouldHide ) {
$hiddenPlugins = [
'complianz-gdpr/complianz-gpdr.php',
//'hello.php',
];
foreach ( $hiddenPlugins as $hiddenPlugin ) {
unset( $plugins[ $hiddenPlugin ] );
}
}
return $plugins;
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment