Skip to content

Commit

Permalink
Set JP plan as a default, but not as an override (#6104)
Browse files Browse the repository at this point in the history
  • Loading branch information
WPprodigy authored Jan 21, 2025
1 parent b444319 commit 92b3227
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function vip_default_jetpack_version() {
} elseif ( version_compare( $wp_version, '6.3', '<' ) ) {
// WordPress 6.2.x.
return '12.8';
} elseif ( version_compare( $wp_version, '6.4', '<' ) ) {
} elseif ( version_compare( $wp_version, '6.4', '<' ) ) {
// WordPress 6.3.x
return '13.1';
} elseif ( version_compare( $wp_version, '6.5', '<' ) ) {
Expand Down Expand Up @@ -492,22 +492,17 @@ function vip_jetpack_token_send_signature_error_headers( $error ) {
) );

/**
* Prevent the jetpack_active_plan from ever being overridden.
*
* All VIP sites should always have have a valid Jetpack plan.
*
* This will prevent issues from the plan option being corrupted,
* which can then break features like Jetpack Search.
* Prevent the jetpack_active_plan from missing.
* All VIP sites should always have a valid Jetpack plan.
*/
add_filter( 'pre_option_jetpack_active_plan', function ( $pre_option ) {
add_filter( 'default_option_jetpack_active_plan', function ( $default_value ) {
if ( true === WPCOM_IS_VIP_ENV && defined( 'VIP_JETPACK_DEFAULT_PLAN' ) ) {
return VIP_JETPACK_DEFAULT_PLAN;
$default_value = VIP_JETPACK_DEFAULT_PLAN;
}

return $pre_option;
return $default_value;
} );


/**
* Load the jetpack plugin according to several defines:
* - If VIP_JETPACK_SKIP_LOAD is true, Jetpack will not be loaded
Expand Down

0 comments on commit 92b3227

Please sign in to comment.