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/ */

    

thefrosty / wordpress-mu-loader example snippets


wp_plugin_mu_loader()->loadPlugin( 'wordpress-seo/wp-seo.php' );

 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;

/**
 * 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',
        'stream/stream.php',
    ]);
}

\add_action('muplugins_loaded', function () {
    $plugins = getRequiredPlugins();
    \array_walk($plugins, function (string $plugin_basename) {
        try {
            if (!\function_exists('wp_plugin_mu_loader') &&
                // You only need the file_exists/