External HTTP API calls slowing down WordPress admin [closed]

You can block/allow external requests if you like, using a combination of WP_HTTP_BLOCK_EXTERNAL and WP_ACCESSIBLE_HOSTS. Here is the note from /wp-includes/class-http.php:

/**
 * Block requests through the proxy.
 *
 * Those who are behind a proxy and want to prevent access to certain hosts may do so. This will
 * prevent plugins from working and core functionality, if you don't include api.wordpress.org.
 *
 * You block external URL requests by defining WP_HTTP_BLOCK_EXTERNAL as true in your wp-config.php
 * file and this will only allow localhost and your site to make requests. The constant
 * WP_ACCESSIBLE_HOSTS will allow additional hosts to go through for requests. The format of the
 * WP_ACCESSIBLE_HOSTS constant is a comma separated list of hostnames to allow, wildcard domains
 * are supported, eg *.wordpress.org will allow for all subdomains of wordpress.org to be contacted.
 *
 * @since 2.8.0
 * @link https://core.trac.wordpress.org/ticket/8927 Allow preventing external requests.
 * @link https://core.trac.wordpress.org/ticket/14636 Allow wildcard domains in WP_ACCESSIBLE_HOSTS
 *
 * @staticvar array|null $accessible_hosts
 * @staticvar array      $wildcard_regex
 *
 * @param string $uri URI of url.
 * @return bool True to block, false to allow.
 */

So if you want to speed things up by disallowing these API calls on most admin pageloads, you could block thing if not on the dashboard with something like this (as an mu-plugin?) – so that licenses do get checked on the dashboard. (But there are also plugin settings pages and AJAX/REST requests to allow for.) Experimentally:

add_action( 'muplugins_loaded', 'block_external_if_not_dashboard' );
function block_external_if_not_dashboard() {

    /* bug out conditions */
    if ( wp_doing_ajax() ) {return;}
    if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {return;}
    if ( !is_admin() ) {return;}
    if ( isset( $_REQUEST['page'] ) ) {return;}
    if ( '/wp-admin/' === substr( $_SERVER['REQUEST_URI'], -10, 10 ) ) {return;}

    /* block access to external HTTP requests */
    if ( !defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && !defined( 'WP_ACCESSIBLE_HOSTS' ) ) {
        define( 'WP_HTTP_BLOCK_EXTERNAL', true );
        define( 'WP_ACCESSIBLE_HOSTS', 'api.wordpress.org' );
    }
}

Of course, there’s no guaranteeing this won’t affect some plugins, so if they malfunction you’d need to add their hosts to the list in WP_ACCESSIBLE_HOSTS