Update search-filter.php - redirect fix - #35
Open
0v3rth3d4wn wants to merge 3 commits into
Open
Conversation
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
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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