Starting from version 2.0.18 you can turn off single store pages in WordPress directly in plugin settings.

disable single store page

Maybe you are wondering if there is an option to disable the single store pages? For example in some cases your stores listing are distributors, not your own stores. So, ideally, you only want them to show up in search results and for people to get directions, but not for them to be clickable and to have a dedicated page for each one of them.In this case place the following code into your functions.php file of your child theme:

<?php 
add_action( 'template_redirect', 'we_redirect_single_stores_pages' );
function we_redirect_single_stores_pages() {
if ( is_singular( 'stores' ) ) {
wp_redirect( home_url(), 301 );
exit;
}
}
?>

This will simply redirect all single store pages to your home page. Of course you can also change the URL by replacing home_url().

2 thoughts on “Disable single store pages in WordPress

  1. Santo says:

    Hi, the code snippet appears to be missing on this FAQ. What is the code snippet required in the functions.php file?

Leave a Reply

Your email address will not be published.