Skip to content

Instantly share code, notes, and snippets.

@JoelLisenby
Last active September 26, 2024 17:02
Show Gist options
  • Save JoelLisenby/85bb9dd5ad8572374c364fbceb164863 to your computer and use it in GitHub Desktop.
Save JoelLisenby/85bb9dd5ad8572374c364fbceb164863 to your computer and use it in GitHub Desktop.
WordPress vs WPengine Proxy Function for Plugin Updates
<?php
// Add to functions.php or your own plugin
add_filter('http_request_args', 'apply_proxy_for_updates', 10, 2);
function apply_proxy_for_updates($http_args, $url) {
// Check if the URL is for an update check or download
if (strpos($url, 'wordpress.org') !== false) {
$http_args['proxy'] = array(
'host' => 'your.proxy.server',
'port' => 'proxy_port_number',
// Add username and password if your proxy requires authentication
'username' => 'your_username',
'password' => 'your_password',
);
}
return $http_args;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment