creode / mu-plugin-installer
Facilitates WordPress MU-Plugin installation and separates them into different files.
Installs: 9
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:composer-plugin
Requires
- composer-plugin-api: ^2.0
- composer/installers: ^2.0
Requires (Dev)
- composer/composer: ^2.0
README
This is a Composer plugin that installs mu plugins into the wp-content/mu-plugins
directory. This differs from other solutions as each mu-plugin has it's own dedicated entrypoint file. This means that mu-plugins screen in WordPress has a more accurate representation of which plugins are installed and at what version they are running.
Installation
You can install this package as part of your mu-plugin's composer.json
file.
composer require creode/mu-plugin-installer
Usage
Add the following to your composer.json
file of your mu-plugin:
{ "extra": { "wordpress-muplugin-entry": "{an-entrypoint-file-name}.php" } }
Supported Package Types
wordpress-muplugin
Available Placeholders
:PLUGIN_VERSION:
- The version of the plugin which will be pulled in dynamically from composer at install time.
Example
Below is an example of a mu-plugin entrypoint file that will be installed into the wp-content/mu-plugins
directory. This demonstrates the use of the :PLUGIN_VERSION:
placeholder.
/** * Plugin Name: WordPress Blocks * Description: WordPress Blocks plugin used by Creode to assist in the development of WordPress blocks. * Version: :PLUGIN_VERSION: * * @package Creode Blocks */ // This is a loader for the plugin from the parent directory to handle MU Plugin installation. require_once __DIR__ . '/wordpress-blocks/plugin.php';
The above example will install the plugin into the wp-content/mu-plugins
directory and create a file called wordpress-blocks.php
in the wp-content/mu-plugins
directory. The file will contain the following content:
/** * Plugin Name: WordPress Blocks * Description: WordPress Blocks plugin used by Creode to assist in the development of WordPress blocks. * Version: 1.9.0 * * @package Creode Blocks */ // This is a loader for the plugin from the parent directory to handle MU Plugin installation. require_once __DIR__ . '/wordpress-blocks/plugin.php';