1. Go to this page and download the library: Download wpsmith/mupluginmanager library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wpsmith / mupluginmanager example snippets
use WPS\WP\MuPlugins\MuPluginManager;
/**
* Gets the MU plugin manager.
*/
function get_muplugin_manager() {
// Path to the actual MU plugin located within this plugin.
$src = plugin_dir_path( __FILE__ ) . ' MuPluginManager::on_activation( get_muplugin_manager() );
} );
register_deactivation_hook( __FILE__, function() {
try {
MuPluginManager::on_deactivation( get_muplugin_manager() );
} catch ( \Exception $e ) {
MuPluginManager::write_log( 'MU Plugin threw an error' );
MuPluginManager::write_log( $e->getMessage() );
}
} );
use WPS\WP\MuPlugins\MuPluginManager;
/**
* Gets the MU plugin manager.
*
* @return MuPluginManager MU plugin manager.
*/
function get_muplugin_manager() {
static $mgr;
if ( null !== $mgr ) {
return $mgr;
}
// Path to the actual MU plugin located within this plugin.
$src = plugin_dir_path( __FILE__ ) . 'mu-plugin/example-mu.php';
$dest_filename = 'my-mu-plugin.php';
$mgr = new MuPluginManager( $src, $dest_filename, '0.0.1', 'my-mu-plugin-settings' );
return $mgr;
}
add_action( 'plugin_loaded', array( get_muplugin_manager(), 'add_hooks' ) );
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.