You could use wp_is_mobile
with wp_redirect
if ( wp_is_mobile() AND is_front_page() ) {
wp_redirect( $location, $status );
exit;
}
You can add the js directly to a front-page.php or home.php file or enqueue
it directly from either file.
Example:
add_action('wp_enqueue_scripts', 'load_script');
function load_script(){
wp_enqueue_script( 'script-handle', get_stylesheet_directory_uri() . '/js/your-script.js', array( 'jquery' ) );
}
Related Posts:
- WP page 404 error only on mobile
- Changing theme = change home page for mobile visitors?
- On login redirect to different homepage if user is using a mobile
- Getting error when trying to redirect WP site to mobile site
- When I change slug, will WordPress create redirect from the old URL?
- Why am I getting a 301 on a existing post?
- Non-WordPress page in subdirectory under WordPress page
- Keeps on redirecting on my development copy
- Password change when the user login first time
- Custom login form redirect to external site
- Clarification on auth_redirect()
- Exclude a path from WordPress using .htaccess redirects (Apache)
- Restrict Access to wp-login.php
- Redirect to custom URL after registering from a page with registration form
- Stop unwanted WP redirection to new url
- Problem to redirect custom page using htaccess
- WordPress Customizer: custom redirection after closing
- Website redirecting to old domain name
- How to do 301 redirect to Sub page using htaccess file?
- Redirect guest if he tries to access a specific page
- htaccess 301 redirect http to https doesn’t work
- Site redirecting from http to https [closed]
- Localhost wordpress site redirects to public site
- Use htaccess to redirect WordPress to static website in a subfolder
- Defining a custom 404 for non-WordPress parts of site
- Redirect homepage ( www.sitename.com ) to the latest post
- How to redirect URL with subfolder to the same URL but without subfolder?
- What is the right way to redirect all traffic to HTTPS?
- Site loads very slowly (4-5 minute load time)
- If User is NOT Logged in and Page ID is not 6 – Redirect to Login
- Snippet for own (gr)avatars
- Front end user creation form! How do you keep the user on the same page in event of error?
- 503 Service Unavailable error was encountered
- SSL and www to non-www redirection works only on homepage – WordPress
- How to redirect if a background request is still being executed
- WP site in infinite redirect loop
- WordPress keeps redirecting subpages without http to https homepage after switch
- Redirect non-existent subpages to second part of url
- How to remove the [L] Flag for WordPress index .php mod_rewrite
- ReDirect subfolder link to another sub-folder and force SSL
- How do I remove the RSS Feed Redirect?
- Two WordPress installations: One in root and one in sub directory – no images in subdir installation [closed]
- Redirect user to original url after login?
- User redirect to specific URL after logging in
- A WordPress site with more than one domain name / Parked domains
- Redirect user if they are not logged in
- BuddyPress – Redirects on Login and Logout
- How to redirect a wrong search on my wordpress website to the error 404 page?
- store URL global before we redirect
- Redirect to page for KPI/marketing purpouses
- Will deleting WP’s code in .htaccess cause problems?
- adding GET variables to a header() location in a page template
- Migrating to Tumblr [closed]
- Parked domain redirect
- WordPress CSS/Theme gone after SSL got activated
- Redirecting DNS without breaking everything
- redirect “about author” code to about page
- How to redirect non existent pages/posts in wordpress using htaccess
- redirect doesn’t work while using example code
- Blackberry mobile theme redirection
- How to redirect a child page to its parent page?
- 301 redirect after removing language directories
- wp_login_form() redirect same page
- Redirect user after login to prior page through a wp_login hook
- Redirect *.php to path using web.config file
- How can force redirected to login for two or more pages to view or access
- WordPress not linking correctly with .htaccess redirect to subdirectory
- Auto redirect to different web page
- WordPress installed on a virtual machine and behind a reverse proxy is redirecting to the VM’s IP address
- wp_redirect() not redirecting user to supplied URL
- How to redirect?
- How to disable WordPress URL autocomplete / recognition?
- using wp_rewrite but keep the original url in the address bar
- Some links keeps redirecting to another domain
- Redirect user on login using extra field value on login form
- Redirect every link that starts with
- login redirect problem – db charset issue?
- Custom login-form redirect
- Link to another website with the same url path
- Redirect to Page after Login (with variable)
- I have cloudflare flexible enabled, How to redirect to https for Nginx server
- .htaccess not working after page slug change
- can’t handle a redirect
- Login Form Redirection
- How can public access to WordPress query (e.g. author=) URLs be redirected?
- Wrong Redirection
- WordPress HTTPS – ‘… better to use HTTP for installation …’
- Rewrite rule for incoming urls
- Detect if request is coming from wordpress conditional statement
- WordPress on a subfolder but accessible from root
- Plugin html-on-pages: URL not redirecting
- Hide page for user logged and redirect for profile? [duplicate]
- Redirect a WP to another with all URL
- Redirect ignore last URL segment
- Forcing header cache control in 404 pages
- Regex for pdf’s – Old .asp Site folder structure to new WordPress Media Folder(s)
- Redirect if a user has not written a post
- Create a custom redirect link that tracks the first visited page and after submitting form goes to first page using formidable forms plugin? [closed]
- WordPress not use site url when redirect 301
- Redirect certain 404 pages to parent page