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
- get_template_directory adding FTP root folders in urls
- In jquery use php variable to execute an enqueued jquery file
- Enqueue script on every page except one
- Run a jquery script on on a certain template page
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- Does size of a theme’s functions.php file matter?
- Functions php shortcode for displaying main menu with no child items
- get_next_posts_link() returns no result despite available posts
- Nav menus all outputting the same links
- PHP 7.1 | Warning: A non-numeric value encountered in
- wp_enqueue_script | Help me figure out what is causing jQuery is not defined
- Load JS file only in specific template
- How to insert class in each list of categories?
- Parent theme styles overriding child theme CSS [closed]
- Proper Way to Load stylesheet on Condition
- Getting the teaser text without overriding global variables
- Combine two active_callbacks into one on theme customizer
- 404 when enqueue_script using plugin_url
- WP Customizer API loaded into functions.php
- call_user_func_array() expects parameter 1 to be a valid callback, function
- why can’t i add front.css to my frontpage.php
- 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
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- Do we need to change our child function.php to require/include child dir files when we add an over-riding file.php into the child theme
- Is this an acceptable practice for WordPress theme development?
- What is the correct way to include my new functions and scripts in WordPress?
- video.js not enqueueing?
- Include Jquery libraries in wordpress theme?
- wp_nav_menu work in functions.php but not in the theme
- Rewrite Question Mark in Post Template with URL Parameter for clean URLs
- Problem enqueuing scripts on not single posts
- Page Template Won’t Load Correct CSS File
- Call two different function.js depending on page
- contact form in template with jquery,validate and ajax
- Enqueueing a code block from an options framework
- Why a SlideShow (made using JQuery FlexSlider) can’t work if I load it form functions.php but work if I load it from my footer.php file? [closed]
- Enqueueing scripts selectively & activation where needed
- Why is this function crashing my wordpress installation? [closed]
- colorbox not loading in
- Fatal error: allowed memory size when after using enqueue_script
- wp_enqueue_script() not working
- Adding google fonts to WordPress theme
- Woocommerce Variable Product Dropdown for Custom Shop Template
- How to use wp_enqueue_script properly?
- Get webpack to work on child theme
- How to fix Function create_function() is deprecated in / themes
- Exclude specific post from query
- How to load a css file depending on the current role
- localize_script but data changes dependent on product ID
- 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 (#)?
- Can I use ‘Featured Image’ as a hero image and a thumbnail?
- How to reference different css (bootstrap) stylesheets for the header and body of a page?
- Is_Page doesnt detect my page
- Find out the reason that the Styles and scripts in the theme are loading properly in localhost but Not in server after deploying
- CSS style and app.js not loading
- Stylesheet does not load despite functions.php
- How to customize archive widget only for cpt?
- How to make the RTL.css the dominant css code?
- wp_title() return random number
- Why does echo on functions.php not yield result in source code?
- Why does my wp_enqueue_script() only insert the script for logged in users
- How to offset main query without affecting other queries and backend
- Unable to declare AOS library in functions
- How do I create a child theme from PowerMag theme
- Add meta data in head from theme
- what is `get_section()` and how to use it?
- 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?
- I need to completely ‘wp_dequeue_script’; what’s the best way?
- HowTo: Add wrapper to columns shortcode?