[wp-trac] [WordPress Trac] #52397: The function wp_is_mobile should accept also lower case strings as user agents
WordPress Trac
noreply at wordpress.org
Fri Jan 29 13:20:21 UTC 2021
#52397: The function wp_is_mobile should accept also lower case strings as user
agents
-------------------------+-----------------------------
Reporter: giuse | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.6
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
The actual version of the function wp_is_mobile is case sensitive and
detects a mobile device only if the first letter of the User Agent is
capital.
https://developer.wordpress.org/reference/functions/wp_is_mobile/
For example, I would replace
{{{
strpos( $_SERVER['HTTP_USER_AGENT'], 'Mobile' ) !== false
}}}
with
{{{
strpos( strtolower( $_SERVER['HTTP_USER_AGENT'] ),'mobile' ) !== false
}}}
The same for the other User Agents.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52397>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list