Title: wp_check_browser_version
Published: April 25, 2014
Last modified: February 24, 2026

---

# wp_check_browser_version(): array|false

## In this article

 * [Return](https://developer.wordpress.org/reference/functions/wp_check_browser_version/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_check_browser_version/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_check_browser_version/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_check_browser_version/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_check_browser_version/?output_format=md#wp--skip-link--target)

Checks if the user needs a browser update.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_check_browser_version/?output_format=md#return)󠁿

 array|false Array of browser data on success, false on failure.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_check_browser_version/?output_format=md#source)󠁿

    ```php
    function wp_check_browser_version() {
    	if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
    		return false;
    	}

    	$key = md5( $_SERVER['HTTP_USER_AGENT'] );

    	$response = get_site_transient( 'browser_' . $key );

    	if ( false === $response ) {
    		$url     = 'https://api.wordpress.org/core/browse-happy/1.1/';
    		$options = array(
    			'body'       => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
    			'user-agent' => 'WordPress/' . wp_get_wp_version() . '; ' . home_url( '/' ),
    		);

    		if ( wp_http_supports( array( 'ssl' ) ) ) {
    			$url = set_url_scheme( $url, 'https' );
    		}

    		$response = wp_remote_post( $url, $options );

    		if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
    			return false;
    		}

    		/**
    		 * Response should be an array with:
    		 *  'platform' - string - A user-friendly platform name, if it can be determined
    		 *  'name' - string - A user-friendly browser name
    		 *  'version' - string - The version of the browser the user is using
    		 *  'current_version' - string - The most recent version of the browser
    		 *  'upgrade' - boolean - Whether the browser needs an upgrade
    		 *  'insecure' - boolean - Whether the browser is deemed insecure
    		 *  'update_url' - string - The url to visit to upgrade
    		 *  'img_src' - string - An image representing the browser
    		 *  'img_src_ssl' - string - An image (over SSL) representing the browser
    		 */
    		$response = json_decode( wp_remote_retrieve_body( $response ), true );

    		if ( ! is_array( $response ) ) {
    			return false;
    		}

    		set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS );
    	}

    	return $response;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/dashboard.php#L1808)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/dashboard.php#L1808-L1856)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_check_browser_version/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_get_wp_version()](https://developer.wordpress.org/reference/functions/wp_get_wp_version/)`wp-includes/functions.php` |

Returns the current WordPress version.

  | 
| [set_url_scheme()](https://developer.wordpress.org/reference/functions/set_url_scheme/)`wp-includes/link-template.php` |

Sets the scheme for a URL.

  | 
| [wp_http_supports()](https://developer.wordpress.org/reference/functions/wp_http_supports/)`wp-includes/http.php` |

Determines if there is an HTTP Transport that can process this request.

  | 
| [wp_remote_post()](https://developer.wordpress.org/reference/functions/wp_remote_post/)`wp-includes/http.php` |

Performs an HTTP request using the POST method and returns its response.

  | 
| [wp_remote_retrieve_response_code()](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_response_code/)`wp-includes/http.php` |

Retrieves only the response code from the raw response.

  | 
| [wp_remote_retrieve_body()](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_body/)`wp-includes/http.php` |

Retrieves only the body from the raw response.

  | 
| [set_site_transient()](https://developer.wordpress.org/reference/functions/set_site_transient/)`wp-includes/option.php` |

Sets/updates the value of a site transient.

  | 
| [home_url()](https://developer.wordpress.org/reference/functions/home_url/)`wp-includes/link-template.php` |

Retrieves the URL for the current site where the front end is accessible.

  | 
| [get_site_transient()](https://developer.wordpress.org/reference/functions/get_site_transient/)`wp-includes/option.php` |

Retrieves the value of a site transient.

  | 
| [is_wp_error()](https://developer.wordpress.org/reference/functions/is_wp_error/)`wp-includes/load.php` |

Checks whether the given variable is a WordPress Error.

  |

[Show 5 more](https://developer.wordpress.org/reference/functions/wp_check_browser_version/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_check_browser_version/?output_format=md#)

| Used by | Description | 
| [dashboard_browser_nag_class()](https://developer.wordpress.org/reference/functions/dashboard_browser_nag_class/)`wp-admin/includes/dashboard.php` |

Adds an additional class to the browser nag if the current version is insecure.

  | 
| [wp_dashboard_browser_nag()](https://developer.wordpress.org/reference/functions/wp_dashboard_browser_nag/)`wp-admin/includes/dashboard.php` |

Displays the browser update nag.

  | 
| [wp_dashboard_setup()](https://developer.wordpress.org/reference/functions/wp_dashboard_setup/)`wp-admin/includes/dashboard.php` |

Registers dashboard widgets.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_check_browser_version/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_check_browser_version%2F)
before being able to contribute a note or feedback.