Created
September 28, 2017 18:19
-
-
Save JoryHogeveen/b91d144c9916df430c821fcd834a9667 to your computer and use it in GitHub Desktop.
WordPress mu-plugins loader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Load the mu-plugins just like regular plugins. | |
*/ | |
$directory = scandir( WPMU_PLUGIN_DIR ); | |
foreach ($directory as $dir) { | |
if ( $dir === '.' || $dir === '..' ) continue; | |
if ( is_dir( WPMU_PLUGIN_DIR . '/' . $dir ) && file_exists( WPMU_PLUGIN_DIR . '/' . $dir . '/' . $dir . '.php' ) ) { | |
define( 'MU_PLUGIN_' . strtoupper($dir) . '_URL', content_url() . '/mu-plugins/' . $dir ); | |
include_once( WPMU_PLUGIN_DIR . '/' . $dir . '/' . $dir . '.php' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Load the mu-plugins just like regular plugins.
Add this file in the
wp-content/mu-plugins/
folder