0

I have a website that is sort of e-commerce website. The list of products is on the homepage. On the left side is a sidebar where you can filter products. Once 2 filters of one category are selected you will get a link that looks like this yourdomain/?_category=item1+item2. The problem is that once you reload the page or if you want to share that link with someone, it becomes like that: yourdomain/?_category=item1%20item2. Plus sign is gone and there is %20 instead. What makes it even more interesting is that it happens only on the homepage. As soon as the page is not set to be a front page, it works well.

The same happens here: https://wordpress.org/?query=test+string

Here it works fine: https://wordpress.org/download/?query=test+hello

2
  • URL special characters are encoded by default and you can not avoid this.
    – Gregory
    Nov 5, 2022 at 0:26
  • Thank you @Gregory Nov 6, 2022 at 20:00

1 Answer 1

0

This is a late reply, but this should allow such query strings on the homepage...

add_filter('redirect_canonical','disable_frontpage_canonical_redirect');
function disable_frontpage_canonical_redirect($redirect)
{
    if (is_front_page()) {
        $redirect = false;
    }
    return $redirect;
}
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.