Airplane_Mode_Core::bypass_theme_api_result PHP Method

bypass_theme_api_result() public method

Hijack the expected themes API result.
public bypass_theme_api_result ( array | object | WP_Error $res, string $action, object $args ) : boolean
$res array | object | WP_Error WordPress.org Themes API response.
$action string Requested action. Likely values are 'theme_information', 'feature_list', or 'query_themes'.
$args object Arguments used to query for installer pages from the WordPress.org Themes API.
return boolean An empty array if enabled, otherwise the existng result.
        public function bypass_theme_api_result($res, $action, $args)
        {
            // Bail if disabled.
            if (!$this->enabled()) {
                return $res;
            }
            // Return false on feature list to avoid the API call.
            return !empty($action) && in_array($action, array('feature_list', 'query_themes')) ? array() : $res;
        }