From d49ce0a604bfda1b5c1618f5cc1260a1ca5eb168 Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Thu, 24 Jan 2019 16:47:57 +0200 Subject: [PATCH] Sync: Consider whitelisted option filters (#11094) Currently, when we check whether an option is whitelisted for syncing, we check against the default list of options. This means that any additional options that we register by using the filters aren't considered. This PR changes this, so now the filters will be considered and any options that have been added by using those filters will be synced. This PR is a companion to D22745-code #### Changes proposed in this Pull Request: * Consider option whitelist filters when checking whether an option is whitelisted. #### Testing instructions: * See D22745-code #### Proposed changelog entry for your changes: * Consider option whitelist filters when checking whether an option is whitelisted. --- sync/class.jetpack-sync-defaults.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sync/class.jetpack-sync-defaults.php b/sync/class.jetpack-sync-defaults.php index 8f60c219ceb24..b9ab7402b07a6 100644 --- a/sync/class.jetpack-sync-defaults.php +++ b/sync/class.jetpack-sync-defaults.php @@ -457,7 +457,8 @@ public static function get_comment_meta_whitelist() { ); static function is_whitelisted_option( $option ) { - foreach ( self::$default_options_whitelist as $whitelisted_option ) { + $whitelisted_options = self::get_options_whitelist(); + foreach ( $whitelisted_options as $whitelisted_option ) { if ( $whitelisted_option[0] === '/' && preg_match( $whitelisted_option, $option ) ) { return true; } elseif ( $whitelisted_option === $option ) {