diff --git a/hotfixes/wc-api-dev-jetpack-hotfixes.php b/hotfixes/wc-api-dev-jetpack-hotfixes.php index d76e8a9..7993cd8 100644 --- a/hotfixes/wc-api-dev-jetpack-hotfixes.php +++ b/hotfixes/wc-api-dev-jetpack-hotfixes.php @@ -16,15 +16,24 @@ * See also https://core.trac.wordpress.org/ticket/41358#ticket * See also https://github.com/Automattic/jetpack/pull/7482 * - * This can be removed once we have either of the two fixes above released + * This can be removed once we have either of the two fixes above released. The first + * trigger string is typical of a direct request (e.g. ala Postman) and the second + * trigger string is typical of a request from WordPress.com for Jetpack. * * See also https://github.com/woocommerce/woocommerce/pull/16158 + * + * @since 0.7.0 + * @version 0.7.1 */ function wc_api_dev_jetpack_sync_sender_should_load( $sender_should_load ) { - $starts_with = '/wp-json/wc/v'; - if ( $starts_with === substr( $_SERVER[ 'REQUEST_URI' ], 0, strlen( $starts_with ) ) ) { - $sender_should_load = false; + $trigger_strings = array( '/wp-json/wc/v', '/?rest_route=%2Fwc%2Fv' ); + + foreach( $trigger_strings as $trigger_string ) { + if ( false !== strpos( $_SERVER[ 'REQUEST_URI' ], $trigger_string ) ) { + $sender_should_load = false; + break; + } } return $sender_should_load; diff --git a/readme.txt b/readme.txt index 47849f3..29f86ec 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: automattic, woothemes Tags: woocommerce, rest-api, api Requires at least: 4.6 Tested up to: 4.8 -Stable tag: 0.7.0 +Stable tag: 0.7.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -25,6 +25,9 @@ This section describes how to install the plugin and get it working. == Changelog == += 0.7.1 = +* Fix - add another URI to watch for when disabling sync during API requests + = 0.7.0 = * Fix - disable jetpack sync during rest api requests to avoid slow responses diff --git a/wc-api-dev.php b/wc-api-dev.php index 9b07e32..8360be0 100644 --- a/wc-api-dev.php +++ b/wc-api-dev.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce API Dev * Plugin URI: https://woocommerce.com/ * Description: A feature plugin providing a bleeding edge version of the WooCommerce REST API. - * Version: 0.7.0 + * Version: 0.7.1 * Author: Automattic * Author URI: https://woocommerce.com * Requires at least: 4.4