fix: set correct post context for author hooks #4011 #4037
Merged
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.
Summary
The Feedzy uses the
global $post
inside the hook that changes the Author.In order to allow hooks that rely on the global to work properly, I changed the context while rendering the template part
with the post that is dynamically passed.
Also, a cleanup was added at the end to preserve the original global for further code execution.
Will affect the visual aspect of the product
NO
Screenshots
Import Feed (Pic 1)
Map Content (Pic 2)
Map Content (Pic 3)
Import Posts (Pic 4)
Featured Posts Sticky (Pic 5)
Correct Sticky Frontend (Pic 6)
Test instructions
https://www.techzone.ro/rss-stiri-hardware
as a source, or any other RSS feed. (see Pic 1)Video with the bug can be found here for comparison: https://vertis.d.pr/v/uJ03Oa
Check before Pull Request is ready:
Closes #4011.