Changeset 56638 for trunk/src/wp-includes/vars.php
- Timestamp:
- 09/20/2023 08:49:12 PM (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/vars.php
r56596 r56638 145 145 * 146 146 * @since 3.4.0 147 * @since 6.4.0 Added checking for the Sec-CH-UA-Mobile request header. 147 148 * 148 149 * @return bool 149 150 */ 150 151 function wp_is_mobile() { 151 if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { 152 if ( isset( $_SERVER['HTTP_SEC_CH_UA_MOBILE'] ) ) { 153 // This is the `Sec-CH-UA-Mobile` user agent client hint HTTP request header. 154 // See <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA-Mobile>. 155 $is_mobile = ( '?1' === $_SERVER['HTTP_SEC_CH_UA_MOBILE'] ); 156 } elseif ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { 152 157 $is_mobile = false; 153 158 } elseif ( str_contains( $_SERVER['HTTP_USER_AGENT'], 'Mobile' ) // Many mobile devices (all iPhone, iPad, etc.)
Note: See TracChangeset
for help on using the changeset viewer.