Control content distribution via Jetpack
Jetpack adds a suite of powerful security, performance, and marketing tools to all VIP sites. Various tools to aid in content consumption, distribution, and syndication are added to sites by Jetpack, including:
- Programmatic access to content via the WordPress.com REST API and Jetpack Search
- Subscriptions via the WordPress.com Reader
- Syndication via the WordPress.com Firehose
Sites that require restricted access to content can modify the behavior of these tools depending on their specific use cases.
Enable content distribution
When Jetpack’s content distribution tools are enabled for a site, content is:
- 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.
By default, Jetpack’s content distribution tools are automatically enabled for:
- Sites on an application’s production environment.
- Sites that have Jetpack Search enabled, including non-production sites. By default, Jetpack’s content distribution tools are disabled for non-production sites, but enabling Jetpack Search for a site will override that default setting.
Enable content distribution for all sites on an environment by adding the following code to the vip-config.php
:
if ( ! defined( 'VIP_JETPACK_IS_PRIVATE' ) ) {
define( 'VIP_JETPACK_IS_PRIVATE', false );
}
After the updated code is deployed, the default content distribution features that are included with Jetpack will be restored within 30 minutes.
Specific content distribution features can be selectively enabled by using the jetpack_get_available_modules
filter.
It is possible for environments with IP Allow List or Basic Authentication enabled to enable Jetpack’s content distribution. Access to sites on the environment will continue to be restricted via IP Allow List or Basic Authentication.
Disable content distribution
When Jetpack’s content distribution tools are disabled for a site, 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.
By default, Jetpack’s content distribution tools are automatically disabled for:
- Sites on an application’s non-production environments.
- Sites on an environment that have IP Allow List or Basic Authentication enabled.
For sites that rely on restricting access via plugins or mechanisms that are not native to the VIP Platform (e.g. paywalls), it may be desirable to disable Jetpack content distribution.
Note
Disabling Jetpack content distribution will block content from being accessible through the Jetpack Search API. Therefore, the site will fall back to Core WordPress database search. Jetpack Search can be configured for non-public content to be accessible via authenticated requests. Enabling this function requires that Jetpack Search is activated within the codebase.
To disable Jetpack’s content distribution for all sites on an environment, add the following code to vip-config.php
:
if ( ! defined( 'VIP_JETPACK_IS_PRIVATE' ) ) {
define( 'VIP_JETPACK_IS_PRIVATE', true );
}
After the updated code is deployed, the default content distribution features that are included with Jetpack will be disabled within 30 minutes.
Disable for a network site on a multisite
On a WordPress multisite environment, Jetpack’s content distribution can be code-disabled for one or more specific network sites.
In this code example, content distribution is disabled for a network site with the domain site.example.com
:
if ( 'site.example.com' === $_SERVER['HTTP_HOST'] ) {
define( 'VIP_JETPACK_IS_PRIVATE', true );
}
This code example demonstrates disabling content distribution for a network site that has a site URL with a subdirectory structure:
if ( 'example.com' === $_SERVER['HTTP_HOST'] &&
0 === strpos( $_SERVER['REQUEST_URI'], '/subdirectory-example/' )
) {
define( 'VIP_JETPACK_IS_PRIVATE', true );
}
Prevent Jetpack from automatically connecting
If Jetpack is enabled for a site, it will automatically connect to WordPress.com when the site launches. It might take a few minutes for a site’s connection to Jetpack to appear active after a site launch.
A process will run every hour after that to check that the connection is still active. If the connection is not active, the system will attempt to reconnect.
If an environment needs to be opted out of this behavior, define VIP_JETPACK_AUTO_MANAGE_CONNECTION
as false
in vip-config.php
:
define( 'VIP_JETPACK_AUTO_MANAGE_CONNECTION', false );
Prevent Jetpack from loading
To prevent Jetpack from loading in an environment define VIP_JETPACK_SKIP_LOAD
as true
in
:vip-config.php
define( 'VIP_JETPACK_SKIP_LOAD', true );
Caution
This is uncommon and will completely skip loading Jetpack. Be aware that the environment may lose required functionality and features (e.g. Jetpack Activity Log, Jetpack Social, Jetpack SSO). Do not add this constant unless it has been fully tested against the application on a non-production environment, and there is confidence that Jetpack features will not be used any time in the future.
Last updated: September 28, 2023