Back to search results causes 404

I’ve noticed the following: If I remove &post_type=properties from the search string that the AJAX call creates the page will display correctly. Or if I change it to something else that isn’t properties.

i.e. the query string is ?layout=list&es=1&post_type=properties&location=Coffs+Harbour&page_num=1&paged-1=1

Change it to ?layout=list&es=1&location=Coffs+Harbour&page_num=1&paged-1=1

and the page appears correctly.

Any thoughts on why this would happen? The post type is properties and I’ve resaved permalinks in case there were any issues there but there’s no issues with any other part of the plugin, just appears to be this query that’s created when you filter a search.

Note if you just change the sort order of the results without any filtering (i.e. sort by lowest price) this is the query that’s created and it works fine with back to search results link working AOK

?layout=list&sort=lowest_price&is_address_search_enabled=0&is_collapsed_filter_enabled=0&sort-1=lowest_price&page_num=1&paged-1=1

It appears the issue is clearly the query string that gets created when you add filters to the search using the shortcode instructions?

Warning message in logs if this helps in any way:

[10-Jul-2024 23:57:07 UTC] PHP Warning: Undefined array key “label” in /home/hibbardh/public_html/wp-content/plugins/estatik/templates/front/shortcodes/search/simple.php on line 71

I’ve found a workaround for now which appears to have ‘fixed’ the problem.

in /wp-content/plugins/estatik/templates/front/shortcodes/search/simple.php line 24 I simply commented out the code:

            <input type="hidden" name="post_type" value="properties"/>

This is added when the default search is not detected and then appended to the search query when using a search page that isn’t the ‘default’ search.

Thought I’d add this for anyone else who’s having a similar issue and needs a workaround. I will update once Estatik respond in case there’s another setting that can be change without having to resort to this.

Turns out just simply adding the ‘estatik search results page’ even if you don’t use it for search results is enough here. Hopefully someone else doesn’t fall into the same trap when setting up the plugin in the future. I’d suggest it’s automatically created if it’s required for basic functionality.

All good now.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer