array( 'name' => 'Jetpack', 'type' => 'essential', ), 'akismet/akismet.php' => array( 'name' => 'Akismet', 'type' => 'essential', ), 'google-analytics-for-wordpress/googleanalytics.php' => array( 'name' => 'MonsterInsights', 'type' => 'tracking', ), 'google-site-kit/google-site-kit.php' => array( 'name' => 'Google Site Kit', 'type' => 'tracking', ), 'mailchimp-for-wp/mailchimp-for-wp.php' => array( 'name' => 'MC4WP', 'type' => 'marketing', ), 'woocommerce/woocommerce.php' => array( 'name' => 'WooCommerce', 'type' => 'essential', ), ); $active_external = array(); $tracking_count = 0; foreach ( $external_request_plugins as $plugin_path => $plugin_info ) { if ( Plugin_Theme_Helper::is_plugin_active( $plugin_path ) ) { $active_external[] = $plugin_info['name']; if ( 'tracking' === $plugin_info['type'] ) { ++$tracking_count; } } } // Check if external requests are blocked. $blocked = defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL; $details = array( 'active_external_plugins' => $active_external, 'tracking_plugins' => $tracking_count, 'external_blocked' => $blocked, ); if ( $blocked ) { return static::warning( \__( 'External HTTP requests are blocked on this site. While this can improve performance, it may break plugins that require external API connections like updates, spam filtering, or payment processing.', '0-day-analytics' ), \__( 'Only block external requests if you understand the implications. Essential services like updates and payment processing may not work.', '0-day-analytics' ), $details ); } if ( count( $active_external ) > 5 ) { return static::warning( sprintf( /* translators: 1: number of plugins, 2: list of plugins */ \__( 'You have %1$d plugins that make external HTTP requests: %2$s. Each external connection can slow down your pages if the remote server is slow or unresponsive.', '0-day-analytics' ), count( $active_external ), implode( ', ', array_slice( $active_external, 0, 4 ) ) . '...' ), \__( 'Review if all these plugins are necessary. Consider disabling unused features that make external calls, or use caching plugins that can minimize API requests.', '0-day-analytics' ), $details ); } if ( $tracking_count > 1 ) { return static::info( sprintf( /* translators: %d: number of tracking plugins */ \__( 'You have %d analytics/tracking plugins active. Consider consolidating to a single solution to reduce external requests.', '0-day-analytics' ), $tracking_count ), $details ); } return static::pass( \__( 'Your site has a reasonable number of plugins making external connections. External requests are not likely causing significant slowdowns.', '0-day-analytics' ), $details ); } } }