rmorse / search-filter

Search & Filter is a simple search and filtering plugin for WordPress
GNU General Public License v2.0
93 stars 41 forks source link

Update search-filter.php - redirect fix #35

Open 0v3rth3d4wn opened 7 years ago

0v3rth3d4wn commented 7 years ago

On line 86, you are attaching an action, which has wp_redirect, which is attached to get_header. I think the last action you should be using to redirect is "template_redirect" - I am suggesting you use "wp". If you keep it like this you are assuming that nothing would be echoed to the screen before "get_header". I am using the Sage template, which has some code before "get_header" and throws "headers already sent" error - https://github.com/roots/sage/blob/8.5.0/base.php#L14

bknightly commented 7 years ago

My site was not redirecting to an archive page, and instead was just refreshing the page with no change. After applying the adjustment to line 86 in search-filter.php, the plugin now works as it should!

Big thanks @0v3rth3d4wn for the find. Hope this PR gets approved, or an equivalent fix is worked into the free version of this plugin once it's updated.