Skip to content

Backgrounds

How-to Guides

Technical References

Restricting Site Access /

Controlling content distribution via Jetpack

Jetpack adds a suite of powerful security, performance, and marketing tools to all VIP sites, including various tools to aid in content consumption, distribution, and syndication. These include:

For sites with restricted access, you may want to change the behavior of these tools depending on your specific use cases.

Enabling content distribution

For sites that rely on IP Allow List or Basic Auth to restrict access, we automatically disable Jetpack’s content distribution tools. This means that content is blocked from being:

  • Accessed via the WordPress.com REST API or Jetpack Search via unauthenticated requests
  • Consumed via the WordPress.com Reader
  • Syndicated via the WordPress.com Firehose

If you would prefer to leave your site restricted but still want your content to be distributed via Jetpack, you can add the following code snippet to your vip-config.php file:

if ( ! defined( 'VIP_JETPACK_IS_PRIVATE' ) ) {
	define( 'VIP_JETPACK_IS_PRIVATE', false );
}

Within 30 minutes, the default content distribution features that are included with Jetpack will be restored.

If you would like to fine-tune which content distribution features are enabled, you can do so using the jetpack_get_available_modules filter.

Disabling content distribution

For sites that rely on restricting access via plugins or mechanisms that aren’t native to the VIP Platform (e.g. paywalls), you may want to restrict content distribution via Jetpack.

To do so, you can add the following code snippet to your vip-config.php file:

if ( ! defined( 'VIP_JETPACK_IS_PRIVATE' ) ) {
	define( 'VIP_JETPACK_IS_PRIVATE', true );
}

To restrict content distribution for select subsites in a multisite, you can target the subsite. Here is an example for a subdomain multisite:

if ( 'subsite.example.com' === $_SERVER['HTTP_HOST'] ) {
    define( 'VIP_JETPACK_IS_PRIVATE', true );
}

or for a subfolder multisite

if ( 'example.com' === $_SERVER['HTTP_HOST'] &&
	0 === strpos( $_SERVER['REQUEST_URI'], '/subsite/' )
) {
    define( 'VIP_JETPACK_IS_PRIVATE', true );
}

Within 30 minutes, content will no longer be accessible via Jetpack’s default content distribution features.

Please note, disabling Jetpack Content Distribution will block content from being accessible through the Jetpack Search API. Therefore, WordPress will fall back to its standard database search. You can configure Jetpack Search to make content accessible via authenticated requests by using the snippet provided in our documentation to your client-mu-plugins directory. You’ll also want to make sure that Jetpack Search is activated within your codebase.

Non-production environments

Applications will have content distribution disabled by default in their non-production environments.

If you’d like to keep content distribution enabled for these environments or tweak their behavior, please follow the instructions in the sections above.

Preventing Jetpack From Loading

In case an environment needs Jetpack to be prevented from loading, this can also be achieved by defining a constant in vip-config.php:

define( 'VIP_JETPACK_SKIP_LOAD', true );

WARNING: This is uncommon and will completely skip loading Jetpack, so beware that the environment may lose required functionality and features (e.g. VaultPress backups, audit logs, Publicize, Jetpack SSO). Do not add this constant unless you have fully tested your application and are confident you are not planning to use any Jetpack features.

Preventing Jetpack from being automatically connected

If Jetpack is enabled in VIP Go, it will automatically connect to WordPress.com when the site launches. After that, a process will run every hour to check that the connection is still active, and if that is not the case, the system will attempt to reconnect.

In case an environment needs to be opted out of this behavior, this can be achieved by defining the following constant in vip-config.php:

define( 'VIP_JETPACK_AUTO_MANAGE_CONNECTION', false );

Note that the first connection after the site launch might take up a few minutes to appear active.

Last updated: June 11, 2021