Using WordPress Behind a Proxy

Occasionally, it’s useful to setup a test WordPress installation on a local machine, however, if this machine is on a corporate network, there’s a good chance it uses a proxy server for external requests… this is fine, until you try to install a theme, or a plugin through the built in tools. When these pages try to access wordpress.org to find plugin/theme data, errors are going to be returned and WordPress will return something like:

An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.

Try again

To fix this, simply tell WordPress about your proxy server by adding the following to wp-config.php in the root of your WordPress install:

/* Configure proxy Server */
define('WP_PROXY_HOST', 'www-cache.leeds.ac.uk');
define('WP_PROXY_PORT', '3128');
define('WP_PROXY_USERNAME', '');
define('WP_PROXY_PASSWORD', '');
define('WP_PROXY_BYPASS_HOSTS', 'localhost');

The above example is configured for The University of Leeds’ proxy server. You should be able to obtain your network’s own configuration from your browser config.

  • kakoma

    Nice! Thanks Dan

  • Ben Thompson

    Very useful!

  • abhijeet

    great! Saved my day!

  • kabeza

    Awesome! was looking also for this…

  • Tanawit Udomsup

    Thanks