WC_Tracker::get_wordpress_info
Get WordPress related data.
Method of the class: WC_Tracker{}
No Hooks.
Returns
Array.
Usage
$result = WC_Tracker::get_wordpress_info();
WC_Tracker::get_wordpress_info() WC Tracker::get wordpress info code WC 10.5.0
private static function get_wordpress_info() {
$wp_data = array();
$memory = wc_let_to_num( WP_MEMORY_LIMIT );
if ( function_exists( 'memory_get_usage' ) ) {
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- False positive.
$system_memory = wc_let_to_num( @ini_get( 'memory_limit' ) );
$memory = max( $memory, $system_memory );
}
// WordPress 5.5+ environment type specification.
// 'production' is the default in WP, thus using it as a default here, too.
$environment_type = 'production';
if ( function_exists( 'wp_get_environment_type' ) ) {
$environment_type = wp_get_environment_type();
}
$wp_data['memory_limit'] = size_format( $memory );
$wp_data['debug_mode'] = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? 'Yes' : 'No';
$wp_data['locale'] = get_locale();
$wp_data['version'] = get_bloginfo( 'version' );
$wp_data['multisite'] = is_multisite() ? 'Yes' : 'No';
$wp_data['env_type'] = $environment_type;
$wp_data['dropins'] = array_keys( get_dropins() );
return $wp_data;
}