If you look at the code of wp_is_mobile
you will see that this returns true based on the user agent sent by the browser. It looks for the word ‘mobile’ in the user agent’s name or some other strings that point to mobile devices, like ‘android’ and ‘kindle’. So, that should work.
However, if you are using any caching plugin that plugin will serve the page regardless of the user agent. After all, caching wouldn’t make sense if you would rebuild the page every time a different user agent came in.
Related Posts:
- Dequeue Scripts and Style for Mobile not working?
- Advanced method to control cache of enqueued style/script
- Test CDN link from function.php or wp_enqueue_script/style?
- How to load scripts/styles specific for a page
- Enqueue script o style only if a template part is loaded
- Dequeue script in template isn’t working
- If is multiple page templates
- When using wp_enqueue_script(); in a theme why don’t we use add_action?
- Enqueue scripts not working with if is page conditional tag in functions.php
- Only let plugin add actions to wp_head & wp_footer on single posts
- Scripts not loading when using the wp_enqueue_scripts action
- Some questions about how proper add 2 CSS file in a WordPress theme?
- Why does get_template_directory_uri() not include “www”, only for enqueued stylesheets?
- I can’t add CSS with functions.php
- Theme JS is available but theme CSS isn’t
- Why I can’t load my JavaScripts using an hook inside my functions.php file?
- WordPress wp_dequeue_script remove all other scripts
- Add custom css file after plugin css with WordPress Child Theme functions.php
- wp enqueue style on about us page
- How do I dequeue a Stylesheet, stored in an ‘Assets’ folder?
- I need to ‘wp_dequeue_script’ and ‘styles’ and ADD a bunch of other css and js
- Why is style.css not loading through the functions.php
- custom post with loading script per single post
- using enqueue_script in a shortcode isn’t working
- Issues with title-tag and document_title_parts
- WordPress Enqueue for homepage only, functions.php, wp-framework
- How to get woocommerce inventory status [closed]
- Enqueue Script with data attributes
- Organize functions.php
- TinyMCE custom stylesheets for different post types
- Change parent theme file function in child themes functions.php
- Enqueue less file not working in child theme?
- I created a child theme and it doesn’t work for some of the css files
- Enqueuing External Javascript functions.php
- Child Theme Not Overriding Parent Theme
- Displaying Widgets
- Enqueued Stylesheets Effecting Admin Styles
- Enqueuing Script in functions.php vs on the page
- Changing itemprop from logo to image on custom logo?
- Overwrite Parent Theme add_image_size in Child Theme
- Show excerpt for only first post in query
- How to add css class to image attached in all the posts?
- Is there a way to add a class to non current menu item?
- Is my approach to enqueue styles inefficient?
- Load JS Script only for custom post types
- Register and enqueue style.css custom theme
- How to enable template page only for a post id page
- Add caption functionality to custom WordPress theme
- Not sure if enqueuing js scripts properly
- Best practices regarding the creation of custom widgets?
- admin-ajax.php + load-scripts.php hanging for minutes
- Remove stylesheets from Campaign Monitor plugin
- Remove Custuomize Sections
- get_pages() Returns Only One Item
- Split Media Queries in different files!
- In jquery use php variable to execute an enqueued jquery file
- Run a jquery script on on a certain template page
- wp_enqueue_script | Help me figure out what is causing jQuery is not defined
- Parent theme styles overriding child theme CSS [closed]
- Proper Way to Load stylesheet on Condition
- Getting the teaser text without overriding global variables
- How to load jQuery in TOP of wp_footer?
- get_template_directory_uri() links to child theme not parent
- How to pass variables from one function to another or combine functions
- “options.php” not found
- Include Jquery libraries in wordpress theme?
- Problem enqueuing scripts on not single posts
- contact form in template with jquery,validate and ajax
- Enqueueing scripts selectively & activation where needed
- Adding google fonts to WordPress theme
- Woocommerce Variable Product Dropdown for Custom Shop Template
- Exclude specific post from query
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- Is it possible to load recaptcha script only in url with fragment identifier (#)?
- How to make the RTL.css the dominant css code?
- Why does echo on functions.php not yield result in source code?
- How do I create a child theme from PowerMag theme
- WP Enqueue Script Error
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- Child Theme not loading multiple stylesheets
- How to retrieve image IDs from shortcode content?
- Class::$template_dir_path=get_template_directory();
- True parameter but jquery register in header and not in the footer with wp_register_script
- Javascript and Stylesheet in child page
- Different body image backgrounds on different pages, posts and categories
- How to wp_enqueue_script with html?
- Language switcher for subdomains
- wp_enqueue_script only works outside of action
- How to add next height number in Order Attributes inside the Add new page. [duplicate]
- wp_nav_walker that interacts with widgets to setup mega menu
- java script error Uncaught SyntaxError: Unexpected token ILLEGAL
- Allow tags and attributes in post and pages content
- wp_enqueue_scripts called twice?
- Should I use `get_stylesheet_uri()` or `get_template_directory_uri()` when calling my CSS Stylesheet?
- Enqueue script/style with multiple GET parameters
- Add custom css to theme
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?
- Loading newest dependency javascript module file in functions.php
- functions.php doesn’t load all custom theme assets
- Setcookie not setting cookies anywhere except admin