wp_is_mobile()
does not have any filters or ways to override. What you’ll need to do is build a wrapper of your own around wp_is_mobile()
and use that in your code where you’ve used wp_is_mobile()
.
Something like the following prototype could work for you. Ultimately a better option over the URL parameter might be to use a cookie value that you set/clear based on the user selected preference. See the PHP documentation on setcookie() for more on cookies.
function my_is_mobile() {
static $is_mobile;
if (isset($is_mobile)) return $is_mobile;
if (isset($_REQUEST['mobile']) && $_REQUEST['mobile'] == "no")) {
$is_mobile = false;
return $is_mobile;
}
$is_mobile = wp_is_mobile();
return $is_mobile;
}
Related Posts:
- Excluding iPad from wp_is_mobile
- How to include one class/instance without using global variables
- How to add iOS & fav icons to the theme?
- wp_is_mobile dequeue not working
- Changing the default view of “The Events Calendar” for mobile
- How to display different blocks for mobile and desktops
- Disable plugin / plugin action via theme
- How to add a data attribute to a WordPress menu item
- Functions.php code that only runs on localhost?
- hook a functions to change wp-config from functions.php
- Relative URLs and hide /wp-content/themes/
- How to restrict actions and filters “properly” by conditions
- Extending auth_cookie_expiration based on user role
- Check if the user has explicitly set an excerpt
- Slugs as breadcrumbs for Pages
- Removing Unnecessary Text from Admin Menu without CSS
- Add inline css to theme
- Shortcode with custom content attribute?
- Add a Post Thumbnail to an RSS Feed with custom size
- Automatically add author’s name to post_tag
- Print Dashboard menu name and link
- Remove_filter (‘the_content’, ‘wpautop’) is not working
- Develop function get_template_part in functions.php
- Change comment_reply_link URL
- Ajaxing function in widget class
- WordPress function for 1 to for many
- How can you limit srcset on a single type of page?
- How to fix Warning: call_user_func_array()?
- Select pages by category
- wp_register_script(… $in_footer = true) not working
- I want to get product attirbute in the section below
- Restore Image Title Text
- Output and filter data from a XML url
- What did I do wrong in my functions code, that will not change the “Get New Password” text to “Send It”?
- How do I create a function that simulate the click on Update button for all posts?
- Multisite Ajax serialize return error [object Object]
- Full page template function
- Redirect from “private” page and functions.php which tag add to add_action()?
- PHP mixed with some JS code to update WordPress theme settings
- Display gallery on bottom after content
- Wp admin – Set default value to 999 in comments
- WordPress listen to $_POST in functions.php
- wordpress use single ajax in place of multiple ajax requests in a smarter way
- Add Element as a Filter to the_content
- Storing password (functions.php)
- Can’t properly set the_title add_filter to show short_URL
- WordPress function, Run using Crontab
- Check if the image size is available and if not use ‘full’ image size
- Why There Is No “get content by ID” Function
- Function shortcode – Set Parameter
- Is there a way to prevent a function/method from being called outside a specific hook?
- Missing argument for the function
- get_next_posts_link() returns no result despite available posts
- Randomizing wp_tag_cloud() in child theme
- Nav menus all outputting the same links
- Secondary Menu and Logged In Users
- Modify gform_other_choice_value for specific form and specific field in Gravity Forms
- Init action and refresh page after form action
- Replace plugin function with a custom function?
- Combine two active_callbacks into one on theme customizer
- How to create shortcode with html and php content?
- Add Link to Users List (Backend) to open each users front-end profile
- wp_usermeta – Read from database, but save function broken
- remove/hide wp-editor
- Entirely Different Functions.php per Page?
- Problems with functions.php! Error! [closed]
- Output comment_author in array
- Problem with shortcode inside a shortcode
- Hide Author By-Line if After Certain Date
- Add #primary at the end of navlink permalinks on single posts
- Is there anyway to force is_singular() to be true when not loading template?
- wp_title() return random number
- Postback redirect through add_action is not triggered
- How to add class dynamically from templates
- How to change form action of wp-login page with a function
- How to add link rel tags on paginated posts?
- How to pass data from a plugin to functions.php
- Function to disable “href” anchor tags that contain “a data-name” on mobile only
- Execute jQuery with custom event listener after successfully add an item to the cart
- WordPress hooks to call a function inside a construct
- How to make an If Else on Excerpt Filter
- Translation Function missing text-domain [closed]
- Retrieve a custom form field modified by a filter
- Custom taxonomy not refreshing page on add
- Pagination in Search result
- Custom field not updating via functions upon publishing
- disable WP_error: authentication_failed
- Load a Child Theme’s style.css just before the closing tag
- Can’t wrap my head around this function – any help would be appreciated
- Figure inlined width trigger distorted layout
- Exclude javascript in certain page url and all following url’s after forward slash
- Changing functions.php and .htaccess files
- Shortcode Variations?
- Code in functions.php appearing on front-end and dashboard [closed]
- How to test for a class (from a plugin) in functions.php
- Child Theme not working – CSS gone
- Sessions in word press [duplicate]
- “woocommerce_output_related_products” not working
- Customizer cuistom CSS Priority ordre Issue
- WPDB query suddenly not working