Automattic / Automattic/syndication
blank endpoint_url in PushClient::test_connection()
- Dominant language
- PHP
- Stars
- 107
- Forks
- 44
- Avg merge
- 18m
- Merged PRs (30d)
- 19
Description
Hi,
We are using Syndication 2.1 and faced with the error "Something went wrong when connecting to the site. Site disabled." after submitting the plugin settings, e.g. OAuth token. After some research we found out that it failed in Client_Manager ::test_connection() whilst it's testing the connection.
We've got it working properly by applying the following patch:
```diff --git a/includes/clients/rest-push-new/class-push-client.php b/includes/clients/rest-push-new/class-push-client.php
index a5cc30d..2959f04 100644
--- a/includes/clients/rest-push-new/class-push-client.php
+++ b/includes/clients/rest-push-new/class-push-client.php
@@ -452,6 +452,7 @@ class Push_Client extends Pusher {
* @return bool
*/
public function test_connection( $site_id ) {
+ $this->init( $site_id );
$response = wp_remote_get(
$this->endpoint_url . '/wp-json/wp/v2/posts',
array(
```
We propose to include it into upstream so it hasn't been lost after upgrade.
Thank you,
Vladimir
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in includes/clients/rest-push-new/class-push-client.php at Push_Client::test_connection() and compare how init() prepares endpoint_url. Verify the connection check uses an initialized endpoint before requesting /wp-json/wp/v2/posts. Done means submitting the plugin settings no longer reports the site as disabled because endpoint_url is blank.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100