← All changes
|
jetpack_vendor/automattic/jetpack-search/src/class-plan.php
+6
-1
16.2
→
16.3-beta
View file →
| @@ -49,9 +49,14 @@ | ||
| 49 | 49 | /** |
| 50 | 50 | * Refresh plan info stored in options |
| 51 | 51 | */ |
| 52 | 52 | public function get_plan_info_from_wpcom() { |
| 53 | - $blog_id = Jetpack_Options::get_option( 'id' ); | |
| 53 | + $blog_id = Jetpack_Options::get_option( 'id' ); | |
| 54 | + // An unregistered site (or a stale cache view hiding the registration) has no | |
| 55 | + // blog ID: bail rather than requesting the malformed `/sites//…` path. | |
| 56 | + if ( ! $blog_id ) { | |
| 57 | + return new WP_Error( 'site_not_registered', 'Site not registered.' ); | |
| 58 | + } | |
| 54 | 59 | $response = Client::wpcom_json_api_request_as_blog( |
| 55 | 60 | '/sites/' . $blog_id . '/jetpack-search/plan', |
| 56 | 61 | '2', |
| 57 | 62 | array(), |