From ef91a9409d76de0a0fe512bafcc08eb40f274408 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 17 Jul 2017 14:12:39 +0000 Subject: [PATCH] Make wp_remote_get result filterable I want to filter the wp_remote_get result. In my use-case, if https fails, I switch back to http (in case the user had a bad curl setup/obsolete SSL certificates) and try again. Until now I've been patching the code, but that is, of course, silly! --- Puc/v4p1/UpdateChecker.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Puc/v4p1/UpdateChecker.php b/Puc/v4p1/UpdateChecker.php index dd5a6fd..44ae488 100644 --- a/Puc/v4p1/UpdateChecker.php +++ b/Puc/v4p1/UpdateChecker.php @@ -460,6 +460,8 @@ if ( !class_exists('Puc_v4p1_UpdateChecker', false) ): $result = wp_remote_get($url, $options); + $result = apply_filters($this->getUniqueName('http_result'), $result, $url, $options); + //Try to parse the response $status = $this->validateApiResponse($result); $metadata = null; @@ -822,4 +824,4 @@ if ( !class_exists('Puc_v4p1_UpdateChecker', false) ): } -endif; \ No newline at end of file +endif;