put this code in functions.php file
add_action('wp', 'myfun');
function myfun(){
if(is_single()){
wp_redirect( home_url() ); exit;
}
}
hope this trick solve your problem. all the best 😉
Related Posts:
- Detecting post type within init action
- Force redirect not logged in user to (wp-login.php or wp-admin) for specific page
- ModSecurity && Admin Ajax: Server locking up
- Single page site + pushState?
- Ajax login without redirect/reload
- Get returned URL from wp_remote_post if response code is 302
- Load more posts (Ajax) in tabbed sidebar on single.php
- How to force the admin-ajax.php file to load over HTTPS?
- Usage of wp_send_json_success and wp_redirect at the same time
- Logout and redirect WordPress user id without he refresh the page
- How to redirect all HTTP requests to HTTPS
- PHP “php://input” vs $_POST
- Google Maps API throws “Uncaught ReferenceError: google is not defined” only when using AJAX
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- htaccess – Redirect to subfolder without changing browser URL
- How to solve the error “SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.” in IE
- Show spinner GIF during an $http request in AngularJS?
- Refresh HTML Page in Browser Automatically on Timer – Every 15 Min
- JavaScript implementation of Gzip
- How to manage a redirect request after a jQuery Ajax call
- jQuery: Performing synchronous AJAX requests
- ASP.NET MVC controller actions that return JSON or partial html
- jQuery’s .on() method combined with the submit event
- Generic htaccess redirect www to non-www
- Redirect old php link to wordpress link in .htaccess
- Redirect old php link to wordpress link in .htaccess
- Safely redirect old WordPress blog links to new WP blog
- Double slashes on WordPress Admin URL redirects to wp-login
- Cant login to wp-admin (redirecting to homepage), But CAN login to wp-login.php
- Cant login to wp-admin (redirecting to homepage), But CAN login to wp-login.php
- Ajax takes 10x as long as it should/could
- How to check if I am in admin-ajax.php?
- Best way to end WordPress ajax request and why?
- How to load wp_editor() through AJAX/jQuery
- “Too many redirects” ONLY when trying to access wp-admin page
- How do I skip wordpress’s 404 handling and redirect all 404 errors for static files to 404.html?
- How to cache json with wp-super cache
- Load minimum WordPress environment
- Why use wp_send_json() over echo json_encode()?
- Why use admin-ajax.php and how does it work?
- WordPress Redirect All HTTP requests to HTTPS via .htaccess
- How to get a unique nonce for each Ajax request?
- Redirect entire website to a single page
- Open a Thickbox with content trough AJAX
- Initialize TinyMCE editor / visual editor after AJAX insert
- Check IF is a “single product page” and Check the “role” for a Redirect
- Why not register shortcodes if is_admin dashboard?
- WordPress AJAX with Axios
- Why is die() used at the end of function that handles an Ajax request?
- Why might a plugin’s ‘do_shortcode’ not work in an AJAX request?
- Making my AJAX powered WordPress Crawlable
- Is there a JavaScript API? How to access public and private data in JS?
- Get Previous & Next posts by Post ID
- failed to load wp-admin/admin-ajax.php
- Using Backbone with the WordPress AJAX API
- Using Ajax with a Class file
- Ajax in a settings page (update_option is undefined)
- How to pass data parameter to ajax action function handler
- WordPress Ajax Data Security
- Displaying PHP Errors from admin-ajax.php
- wp_set_auth_cookie() doesn’t work in Ajax call
- gettext does not translate when called in ajax
- Execute one AJAX request after another AJAX request finished
- WP-AJAX vs WP REST API: What to use for requests to the website from outside?
- Ajax and autocomplete
- How to add to cart via AJAX Woocommerce [closed]
- Nonces and Cache
- SSL breaks customizer: page isn’t returned from ajax
- Why is a 500 error generated by admin-ajax.php not going into the Apache error log?
- Stop WordPress and Plugins from Overwriting .htaccess
- Are ‘wp_ajax’ and ‘wp_ajax_nopriv’ exclusive to authenticated and non-authenticated users?
- How to HTML5 FormData Ajax
- admin-ajax.php vs Custom Page Template for Ajax Requests
- How to override WP_DEBUG for Ajax responses?
- Stop admin-ajax?
- redirect out of wp-admin, without losing admin-ajax.php
- Call to undefined function add_action()
- Is it safe to assume that a nonce may be validated more than once?
- Make a video post redirect to next post after completion
- Including WordPress in RESTful API
- Multiple ajax nonce requests
- 301 Redirects for Changed Permalink Structure & Category Base
- Old blog/ and blog/feed/ URLs not working after moving blog to top-level via .htaccess
- Non-WordPress page in subdirectory under WordPress page
- Get posts with ajax
- admin-ajax.php doesn’t work when using POST data and Axios
- How to call a PHP function with Ajax when the user clicks a button
- REST API endpoint for elasticpress autosuggest
- Ajax for non-logged-in users
- Contact Form 7 Custom Post Action
- Custom Form with Ajax
- Force HTTPS using .htaccess – stuck in redirect loop
- How to process ajax requests correctly using ajax plugins
- ajax – why multiple calls to wp_create_nonce() return same value?
- PHP – redirect https to http and www to non-www
- Update user meta using with ajax
- Registering AJAX callback function that is part of a class without instantiating the class in function.php
- How do I turn off 301 redirecting posts (not canonical)?
- WordPress function that makes HTML safe to be sent via AJAX request