PHP code example of thefrosty / wordpress-mu-loader
1. Go to this page and download the library: Download thefrosty/wordpress-mu-loader 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/ */
declare(strict_types=1);
/**
* @wordpress-muplugin
* Plugin Name: WordPress Plugins as Must-use
* Description: Require regular WordPress plugins as "must-use" plugins.
* Version: 1.0.0
* Author: Austin Passy
* Author URI: https://github.com/thefrosty
*/
namespace TheFrosty;
use InvalidArgumentException;
use RuntimeException;
use function add_action;
use function array_filter;
use function array_walk;
use function file_exists;
use function function_exists;
use function wp_plugin_mu_loader;
use const WPMU_PLUGIN_DIR;
/**
* Returns an array of basename formatted plugins to set as "must-use".
* @return array
*/
function getRequiredPlugins(): array
{
// Add plugins to the array here...
return array_filter([
'disable-emojis/disable-emojis.php',
'soil/soil.php',
'custom-login/custom-login.php',
'wp-login-locker/wp-login-locker.php',
]);
}
add_action('muplugins_loaded', static function (): void {
if (
!function_exists('wp_plugin_mu_loader') &&
// You only need the file_exists/
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.