Created
September 26, 2024 09:13
-
-
Save ideag/9d61401a1e073cbfd8739d4e79f0d44a to your computer and use it in GitHub Desktop.
wporg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'pre_http_request', 'arunas_proxy_wporg', 1, 3 ); | |
function arunas_proxy_wporg( $response, $parsed_args, $url ) { | |
if ( 1 === preg_match( '|^https?://api.wordpress.org|ims', $url ) ) { | |
$url = preg_replace( '|^https?://api.wordpress.org|ims', 'http://localhost:10159', $url ); | |
$response = wp_remote_request( $url, $parsed_args ); | |
} | |
return $response; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment