Support » Plugin: The SEO Framework » TSF prevents redirect to search result page on woocommerce

  • Resolved Nikodemsky


    I have checked all other plugins and it’s TSF for sure:

    For some reason TSF prevents redirects to single result page on Woocommerce.

    I have tried removing all of my custom code from functions etc. It’s like that since Woocommerce 3.6.x

    Anything else i can provide to help with the issue?

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Sybre Waaijer


    Hi Nikodemsky,

    Unfortunately, I couldn’t replicate this issue on my testing server.

    What I find peculiar is that the query leads to that specific page:
    Effectively, this query is outputted on the homepage, and it leads to that page:

    Could you inspect the posts, pages, products, etc. that are redirected via The SEO Framework, and find one that’s redirecting to that page? If you’re able to find it, could you try if removing the redirect resolves this issue?


    I’m not really sure what exactly i should look for to be honest, this is standard woocommerce product search widget overwritten by code:

    /** Custom product search form widget **/
    function woo_custom_product_searchform( $form ) {
        $form = '<form role="search" method="get" id="searchform" class="searchform" action="' . esc_url( home_url( '/'  ) ) . '">
    			<label class="screen-reader-text" for="s">' . __( 'Search for:', 'woocommerce' ) . '</label>
    			<input type="hidden" class="" value="product" name="post_type" />
    			<input class="search-widget" type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="' . __( 'Type name or product code...','solidbase' ) . '" />
        return $form;
    add_filter( 'get_product_search_form' , 'woo_custom_product_searchform' );

    – but like i said, even if i remove it issue still occurs.

    It would be like the whole query is messed up?

    If i remove theme support code for woo:

    // Declares woocommerce custom template usage
    function solidbase_woocommerce_support() {
    	add_theme_support( 'woocommerce' );
    add_action( 'after_setup_theme', 'solidbase_woocommerce_support' );

    Then i’m getting “raw” search results:
    – is it maybe related somehow?

    Plugin Author Sybre Waaijer


    Hi Nikodemsky,

    The form prepares a search that leads to the link below; which is the correct endpoint:

    When you remove the theme support, it no longer outputs that altered form, and uses the default WordPress search endpoint (without the post type) instead:

    Could you try implementing this piece of code on your site? You may put it in a theme’s functions.php file or a custom plugin. It will disable redirects initiated by The SEO Framework, which may save the day:

    add_action( 'the_seo_framework_after_front_init', function() {
    	remove_action( 'template_redirect', [ the_seo_framework(), '_init_custom_field_redirect' ] );
    } );

    It works! :>

    Now, that code won’t brake anything else?

    Plugin Author Sybre Waaijer


    Hi Nikodemsky,

    That code disables the whole redirection functionality in The SEO Framework. So, if you use that functionality, you may wish to remove it.

    I’m glad it worked because that confirms that one page redirects the search query incorrectly.

    Could you go over your posts, pages, and products and see if there’s a redirect set?
    The SEO Bar should be a big full blue R (for “Redirect”, may be translated), which helps you find them easier.

    See if any of the redirected pages point their redirection URL to /katalog-produktow/. If you’ve found it, you may wish to remove that redirect; it may be a placeholder “search” page that’s modified by another plugin.

    If that page is modified by a plugin, could you share some details on it? Cheers 🙂

    Jeez, i found it!
    – it is set as shop main page and for some reason it redirects to said /katalog-produktow/

    Any idea why it behaves like that?(i mean why woo search widget redirects to this page)

    • This reply was modified 1 year, 4 months ago by Nikodemsky.
    Plugin Author Sybre Waaijer


    Hi Nikodemsky,

    I’m glad you’ve been able to find it!

    It’s not the search widget that’s the issue, as it merely outputs a form; the input of that form is parsed elsewhere.

    I think it has something to do with the theme or another plugin that overrides the search results page… but I can’t put my finger on it.

    The search results page seems to take the canonical URL of /katalog-produktow/, but that might also be a custom canonical URL input at /produkty/.

    I have reproduced the same bug here:

    The steps are:
    1. Set some page as main shop page
    2. Use redirect on it to something else

    That’s it. Only two plugins are active, no overrides, default theme. It must be something with TSF.

    Plugin Author Sybre Waaijer


    Thanks for that Nikodemsky!

    It’s best for me to lock out that functionality on those pages; these are two conflicting template overrides.

    WooCommerce relies on the shop base for many of its endpoints; when you redirect it, many of the callbacks falter.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘TSF prevents redirect to search result page on woocommerce’ is closed to new replies.