Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some options from scrubbing that are needed on WordPress.com #125

Merged
merged 4 commits into from
Jul 11, 2024

Conversation

Ninodevo
Copy link
Contributor

Changes proposed in this PR

  • Remove Jetpack options from scrubbing that are needed for an active Jetpack connection on WordPress.com, because staging sites don't work on WP.com without Jetpack

@Ninodevo Ninodevo requested a review from nate-allen July 11, 2024 12:29
Copy link
Contributor

@nate-allen nate-allen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested this, but a couple things:

  1. You'll need to return the array after removing the options
  2. You can simplify the code a bit by using array_diff

So something like this:

/**
 * Remove some options from scrubbing that are needed on WordPress.com.
 *
 * @param array $options_to_clear Options to clear.
 *
 * @return array Modified options to clear.
 */
function safety_net_scrub_options_wpcom( $options_to_clear ) {
	if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
		$unset_wpcom_options = array( 'jetpack_private_options', 'jetpack_secrets' );
		$options_to_clear = array_diff( $options_to_clear, $unset_wpcom_options );
	}

	return $options_to_clear;
}
add_filter( 'safety_net_options_to_clear', 'safety_net_scrub_options_wpcom' );

@Ninodevo Ninodevo merged commit 8491bed into trunk Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants