Skip to content

Instantly share code, notes, and snippets.

@johnie
Forked from frozzare/force-enable-plugins.php
Created November 18, 2015 20:59
Show Gist options
  • Save johnie/84b278c7908a42e26255 to your computer and use it in GitHub Desktop.
Save johnie/84b278c7908a42e26255 to your computer and use it in GitHub Desktop.
<?php
/**
* Force enable a plugin.
*
* @param array $plugins
*
* @return array
*/
add_filter( 'option_active_plugins', function ( $plugins ) {
return array_merge( $plugins, [
'akismet/akismet.php'
] );
} );
/**
* Force network enable a pugin.
*
* @param array $plugins
*
* @return array
*/
add_filter( 'site_option_active_sitewide_plugins', function ( $plugins ) {
return array_merge( $plugins, [
'akismet/akismet.php'
] );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment