How to teach Wordpress engine to be friends with Proxy? Easy!

    I am developing a local corporate website powered by Wordpress. The company does not have direct access to the Internet, everyone works through a proxy server.

    To automatically update the kernel and plugins (and some other functions), in order to avoid the message “WP HTTP Error: couldn't connect to host” or even 500 errors on IIS 7 (Windows 2008), I had a need to teach Wordpress to make friends with proxy.

    A search on the Internet yielded nothing. Naturally, the fact that I did not find something does not mean that it is not on the Internet. At least there is no description in Codex. And I had to look into the engine code, and as it turned out, this function is provided there and works fine for myself. Which I hasten to share with you.


    To do this, add at least two lines to any location in the ./wp-config.php file, and two more if the proxy requires authorization: That's all. Tested on versions 3.1+.

    define(WP_PROXY_HOST, 'localhost'); // ваш адрес
    define(WP_PROXY_PORT, 3128); // ваш порт

    define(WP_PROXY_USERNAME, 'username');
    define(WP_PROXY_PASSWORD, 'password');

    Also popular now: