Skip to content

Backgrounds

How-to Guides

Technical References

VIP Codebase /

/plugins directory

The /plugins directory is mapped to /wp-content/plugins/ ; this directory works similarly to WP_CONTENT_DIR . '/plugins/' in a self-hosted WordPress installation. Installing plugins to this location is a matter of adding the plugin to a unique directory in /plugins, e.g. plugins/my-plugin, commit, then push to GitHub (see our documentation on how code is deployed on VIP Go).

We recommend that third-party plugins always go in the /plugins directory, to allow for better compatibility with systems (like security-related plugin updates) that expect plugins to be in a specific location. Custom plugins can go in either the /plugins or /client-mu-plugins directory, depending on the preferred loading behavior.

Loading or activating plugins in the /plugins directory

The plugins in the /plugins directory can be activated and deactivated from the standard Plugins menu in the WordPress admin area, however, we recommend loading your plugins from code. Loading plugins in code results in more control and a greater consistency across your production, non-production environments, and local development environments.

If loading your plugins via code, you should use a plugin loader file in /client-mu-plugins (example) using the wpcom_vip_load_plugin() function:

wpcom_vip_load_plugin( 'plugin-name' );
// Note this requires a specific naming structure: /plugin-name/plugin-name.php

// You can also specify a specific root file: wpcom_vip_load_plugin( 'plugin-name/plugin.php' );

On a multisite install, you can use get_current_blog_id() to load plugins on a per-site basis:

if ( get_current_site_id() === 2 ) {
    wpcom_vip_load_plugin( 'plugin-name' );
}

Last updated: April 09, 2021