Place the following code in the wp-config.php file.

define('WP_HTTP_BLOCK_EXTERNAL', true);