Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Plugin Name: Name of Plugin
- Plugin URI: Link to plugin information
- Description: Plugin Description
- [...]
- Network: Optional. Specify "Network: true" to require that a plugin is activated
- across all sites in an installation. This will prevent a plugin from being
- activated on a single site when Multisite is enabled.
- */
- add_filter( 'all_plugins', 'wpse257256_hide_my_plugin' );
- function wpse257256_hide_my_plugin( $plugins ) {
- if ( is_multisite() && ! is_network_admin() ) {
- unset( $plugins['my-plugin-name/my-plugin-file.php'] );
- }
- return $plugins;
- }
- register_activation_hook( __FILE__, function () {
- if ( is_multisite() && ! strpos( $_SERVER['REQUEST_URI'], 'wp-admin/network/plugins.php' ) ) {
- die ( __( '<script>alert("Activate this plugin only from the NETWORK DASHBOARD.");</script>') );
- }
- // ...............
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement