A fresh mix of code snippets and tutorials

Disable external URL requests

During development there may be situations where you want to prevent WordPress from making URL requests to external websites. Here is a simple way to disable external URL requests during development.

Disable all external requests

To stop WordPress from making any external URL requests, add the following definition to your site’s wp-config.php file:

define('WP_HTTP_BLOCK_EXTERNAL', true);

Allow only specific domains

Instead of blocking all external URL requests, you may want to whitelist some useful domains, like the W3C Validator and other testing tools. Doing so requires an additional definition to be added also to wp-config.php:

define('WP_HTTP_BLOCK_EXTERNAL', true);
define('WP_ACCESSIBLE_HOSTS', 'example.com, domain.com');

Edit the list of allowed domains with your own!

Learn more

Digging Into WordPressWordPress Themes In DepthWizard’s SQL Recipes for WordPress