lisaleague
1/9/2015 - 1:18 PM

From http://pastebin.com/raw.php?i=HBN4gzKs https://www.facebook.com/groups/advancedwp/permalink/885292874866261/ Before experimenting with

From http://pastebin.com/raw.php?i=HBN4gzKs https://www.facebook.com/groups/advancedwp/permalink/885292874866261/

Before experimenting with this, you can always test by adding define( 'WP_HTTP_BLOCK_EXTERNAL', TRUE ); in your wp-config. This will block ALL external HTTP requests on ALL pages. This should tell you if you're on a good track before going any further.

function block_api_calls() {
		$whitelist = 'plugins.php,plugin-install.php,update-core.php';
		
		global $pagenow;
		if (( $pagenow == 'plugins.php' ) || 
		( $pagenow == 'plugin-install.php' ) || 
		( $pagenow == 'themes.php' ) || 
		( $pagenow == 'update.php' ) || 
		( $pagenow == 'index.php' ) || 
		( $pagenow == 'admin.php' ) || 
		( $pagenow == 'update-core.php' )){
			 add_filter( 'pre_http_request', '__return_false', 100 );
		}
		else{
			 add_filter( 'pre_http_request', '__return_true', 100 );
		}		
	}
add_action( 'admin_init', 'block_api_calls', 1 );