From 5d13bdd1efbd6e75b400640f9ff614930bfbf50c Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Thu, 15 Jun 2017 12:04:56 +0000 Subject: [PATCH] General: Introduce a `wp_is_mobile` filter for controlling whether a request should be treated as coming from a mobile device. Props PressLabs Fixes #41023 git-svn-id: https://develop.svn.wordpress.org/trunk@40907 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/vars.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/vars.php b/src/wp-includes/vars.php index 2e97c9a0ae..89b3532327 100644 --- a/src/wp-includes/vars.php +++ b/src/wp-includes/vars.php @@ -139,5 +139,12 @@ function wp_is_mobile() { $is_mobile = false; } - return $is_mobile; + /** + * Filters whether the request should be treated as coming from a mobile device or not. + * + * @since 4.9.0 + * + * @param bool $is_mobile Whether the request is from a mobile device or not. + */ + return apply_filters( 'wp_is_mobile', $is_mobile ); }