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: