Must Use (MU) Plugin
The Kinsta MU (must-use) plugin has been designed to work on our WordPress hosting platform. It handles things such as our full-page caching technology and Kinsta’s CDN integration.
By default, the Kinsta MU plugin is installed on every site we host and is available from the left-hand side of your WordPress admin dashboard. The plugin is required to ensure your site runs smoothly in our environment.
Install the Kinsta MU Plugin
If you’ve migrated your site yourself or installed WordPress manually, you may not have installed the Kinsta MU plugin. We periodically install and update the plugin for every site at Kinsta that doesn’t use Composer or manage the entire wp-content directory or mu-plugins directory in Git. If you prefer or need to manually install the Kinsta MU plugin, you can do so by following one of the applicable methods below.
Installing Via SFTP
Step 1: Create mu-plugins Folder
Connect to your site via SFTP and create a folder called mu-plugins in your wp-content folder if it doesn’t already exist (finished path: /wp-content/mu-plugins/).
![The mu-plugins folder in FTP.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2016%2F08%2Fmu-plugins-folder.png&w=3840&q=75)
Step 2: Download and Unzip the Plugin
After ensuring the mu-plugins folder has been created, download the Kinsta MU plugin and unzip it.
Step 3: Upload to Site
Upload the kinsta-mu-plugins folder and kinsta-mu-plugins.php file to the /wp-content/mu-plugins/ directory.
![Kinsta MU plugin folder and file in FTP.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2016%2F08%2Fkinsta-mu-plugins.png&w=3840&q=75)
This will install the plugin, and you can see it in your WordPress dashboard by logging in and going to Plugins > Must-Use.
Installing Via Composer
If your site is built with Bedrock or any boilerplate or framework that uses Composer, you’ll need to take some extra steps to install the Kinsta Must Use plugin on your site.
Step 1: Declare the Kinsta MU Plugin Package Repository
Begin by declaring the Kinsta MU plugin as a package repository in the repositories
array in your composer.json file:
{
"type": "package",
"package": {
"name": "kinsta/kinsta-mu-plugins",
"type": "wordpress-muplugin",
"version": "2.3.7",
"dist": {
"url": "https://kinsta.com/kinsta-tools/kinsta-mu-plugins.zip",
"type": "zip"
}
}
}
Note: While you can technically set the version number to anything valid (because you’re installing the plugin from a specific zip file), this will need to be changed each time you need to update the plugin, so we recommend checking the version in the latest download of the Kinsta MU plugin.
Step 2: Require the Kinsta MU Plugin
Next, run the following command in your site’s bedrock directory (or the directory where your composer.json file is located).
composer require kinsta/kinsta-mu-plugins
Or, add the Kinsta MU plugin to the require
array in your composer.json file. Here’s an example require
array from a Bedrock site after adding the Kinsta MU plugin:
"require": {
"php": ">=7.4",
"composer/installers": "^2.1",
"vlucas/phpdotenv": "^5.4",
"oscarotero/env": "^2.1",
"roots/bedrock-autoloader": "^1.0",
"roots/bedrock-disallow-indexing": "^2.0",
"roots/wordpress": "5.9.3",
"roots/wp-config": "1.0.0",
"roots/wp-password-bcrypt": "1.1.0",
"kinsta/kinsta-mu-plugins": "^2.3"
},
Step 3: Fix the Path for Kinsta MU Plugin Assets
To fix the path to assets used by the MU plugin, add the following to your site’s configuration file (bedrock/config/application.php in Bedrock sites):
/**
* Fix for Kinsta's CDN with Bedrock
*/
define('KINSTA_CDN_USERDIRS', 'app');
/**
* Fix Kinsta MU Plugins URL path with Bedrock
*/
$mu_plugins_url = Config::get('WP_CONTENT_URL') . '/mu-plugins';
define('KINSTAMU_CUSTOM_MUPLUGIN_URL', "{$mu_plugins_url}/kinsta-mu-plugins");
Installing Via Git
If you use Git with your site, installing the Kinsta MU plugin depends on what parts of the site you manage with Git.
If you manage the entire wp-content directory or mu-plugins directory in your Git repo, you’ll need to download and install the plugin in your local repo, commit that change, and then deploy it to your site. You can install the plugin locally by downloading it and placing plugin files in your site’s mu-plugins directory.
If you do not maintain a copy of the Kinsta MU plugin in your Git repo, we’ll automatically install the Kinsta MU plugin for you, or you can use SFTP to install it manually.
Kinsta MU Plugin Settings
The Kinsta MU plugin is set to work harmoniously with WordPress and our infrastructure. On most sites, it won’t need any modifications. The plugin enables automatic clearing of cache on important parts of your site when you update your page and post content.
The plugin will appear as Kinsta Cache in the left sidebar of your WordPress dashboard. A Clear Caches link is also added to the WordPress admin toolbar.
![Kinsta Cache plugin (Kinsta MU plugin) in the WordPress dashboard.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-kinsta-mu-plugin-clear-cache.png&w=3840&q=75)
Manually Clear Cache
You can also manually clear the cache on your WordPress site with any of the following methods.
- Click the Clear All Caches button on the Kinsta Cache plugin page in your WordPress dashboard.
- Click the Clear Caches link on the WordPress admin toolbar.
- Clear the Site cache and CDN cache in MyKinsta. (When Edge Caching is enabled, clearing the Site cache in MyKinsta also clears the Edge Cache.)
- Run
wp kinsta cache purge --all
in the command line.
![Clear cache with the Clear Caches link in the WordPress dashboard.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-muplugin-clear-caches.png&w=3840&q=75)
Add Custom Caching URLs
We immediately purge key pages, such as the home page, and impose a minimal throttle time on archive pages. This ensures high availability at all times. However, depending on your site’s configuration, additional caching rules may be needed. You can add custom paths to purge whenever your site is updated.
1. Add Single Path Custom URL
If you need cache cleared on an exact URL (post or page), enter this as a single path rule on the Kinsta Cache plugin page in your WordPress dashboard. Examples:
important-page
important-page/
![Custom URL single path in Kinsta Cache.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-kinsta-mu-plugin-custom-url-single-1024x286.png&w=2048&q=75)
2. Add Group Path Custom URL
The group path purges all the URLs that start with that specific URL. This can be especially useful if you have a custom post type and need the cache cleared on it and the posts underneath it. For example, if you add https://yourdomain.com/custom-post-type/
as a group path URL, then it will purge the cache on the following:
https://yourdomain.com/custom-post-type/
https://yourdomain.com/custom-post-type/post-1
https://yourdomain.com/custom-post-type/post-2
https://yourdomain.com/custom-post-type/post-3
![Custom URL group path in Kinsta Cache.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-kinsta-mu-plugin-custom-url-group-1024x304.png&w=2048&q=75)
Cache Autopurge
When you make updates to a post or page, the Kinsta MU Plugin clears the cache automatically. However, if you’re importing a large number of updates, this cache-clearing process might slow down your site. To prevent this, you can use Disable Autopurge to deactivate the automatic cache-clearing feature. Once you’ve completed your updates, you can re-enable automatic cache clearing by clicking Enable Autopurge.
![Disable the cache autopurge to prevent site slowdown when importing a large number of updates.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fkinsta-mu-plugin-autopurge-1024x127.png&w=2048&q=75)
Additional Notes
You aren’t allowed to add only “/” as a path, as this would trigger clearing the site’s entire cache with any post or page update. Purging all cache in this manner would take a significant toll on server resources, especially during high load times and frequent publishing schedules. This could also degrade the performance of your site for visitors as it would have to re-cache everything.
If you have clients and prefer they not see any Kinsta branding, you can also white label the plugin.
Update the Kinsta MU Plugin
If your site doesn’t use Composer or Git, we’ll automatically update the Kinsta MU plugin for you periodically. There’s nothing more you need to do to keep the plugin updated.
Update Via SFTP
If you need to update the plugin manually (perhaps you restored an older backup or an update didn’t go as planned), you can use SFTP to manually update the Kinsta MU plugin.
- Download the Kinsta MU plugin and unzip it.
- Upload the kinsta-mu-plugins folder and kinsta-mu-plugins.php file to the /wp-content/mu-plugins/ directory and overwrite the existing files when prompted by your SFTP client.
- This will overwrite the old plugin files with the new ones to update the plugin to the latest version.
Update Via Composer
Update the version number in the Kinsta MU plugin repository declaration in your composer.json file:
{
"type": "package",
"package": {
"name": "kinsta/kinsta-mu-plugins",
"type": "wordpress-muplugin",
"version": "2.3.7",
"dist": {
"url": "https://kinsta.com/kinsta-tools/kinsta-mu-plugins.zip",
"type": "zip"
}
}
}
Run composer update kinsta/kinsta-mu-plugins
in your site’s bedrock directory (or the directory where your composer.json file is located).
Update Via Git
If you use Git with your site, the process of updating the plugin depends on what parts of the site you manage with Git.
If you manage the entire wp-content directory or mu-plugins directory in your Git repo, you’ll need to update the plugin in your local repo, commit that change, and then deploy it to your site. You can update locally by downloading the plugin and overwriting the existing plugin files in your repo.
If you do not maintain a copy of the Kinsta MU plugin in your Git repo, we’ll automatically update the Kinsta MU plugin for you; there’s nothing more you’ll need to do.
White Label and Customize the Kinsta MU Plugin
In the Kinsta MU plugin, we’ve added Kinsta naming and customizations to help you navigate around the WordPress admin dashboard more easily. For example, the Kinsta Cache tab in the admin dashboard sidebar lets you quickly find the right place to clear your site’s cache when needed.
For agencies and other Kinsta customers who may want to remove the Kinsta branding from the WordPress admin dashboard, we provide a built-in white labeling option. This feature is especially useful if you’re using hosting for or reselling to your own clients.
![Before white labeling the Kinsta MU plugin in your WordPress dashboard.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-kinsta-mu-plugin-1.png&w=3840&q=75)
![After white labeling the Kinsta MU plugin in your WordPress dashboard.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-kinsta-mu-plugin-whitelabel.png&w=3840&q=75)
Enabling white labeling changes the following elements in the WordPress dashboard:
- The Kinsta Cache sidebar link is changed to an unbranded Server Cache link.
- The Thanks for creating with WordPress and hosting with Kinsta message near the bottom of the dashboard is replaced with Thank you for creating with WordPress.
- The links to Kinsta documentation and support are removed.
How to White Label a Kinsta Site
To white label your admin, you’ll need to define a constant, preferably in the wp-config.php file, before the * That's all, stop editing! Happy publishing. */
line. Setting KINSTAMU_WHITELABEL
to true
removes Kinsta branding as described above.
Here’s an example of a white label configuration in wp-config.php.
/* Kinsta MU Plugin White Labeling */
define('KINSTAMU_WHITELABEL', true);
/* That's all, stop editing! Happy publishing. */
Define a Custom Path to the MU Plugin Directory
The plugin uses the WPMU_PLUGIN_URL WP
variable to define paths to the plugin’s assets. While this generally works on all sites, if it doesn’t, you can define the path to your MU plugin folder with the KINSTAMU_CUSTOM_MUPLUGIN_URL
constant.
Here’s an example of a custom MU plugin path in wp-config.php.
/* Custom MU plugin path */
define( 'KINSTAMU_CUSTOM_MUPLUGIN_URL', 'http://kinstaexample.com/custom-wp-content/mu-plugins')
/* That's all, stop editing! Happy publishing. */
Define a Capability for Access
The KINSTAMU_CAPABILITY
constant defines what capability a user must have to use the plugin admin functionality. It accepts any of the default WordPress Roles and Capabilities, like: activate_plugins
or publish_pages
. Here’s an example with the KINSTAMU_CAPABILITY
constant added:
/* Capability to use the caching plugin */
define('KINSTAMU_CAPABILITY','publish_pages');
/* That's all, stop editing! Happy publishing. */
Disable White Labeling
To disable white labeling, just remove any constants from wp-config.php. White labeling is just one example of Kinsta’s extensive feature set for WordPress agencies and single users alike. If you’re interested in other site management features on Kinsta, check out our site labeling and site renaming tools!