Conditional eager-loading of post meta values#2012
Closed
aj-adl wants to merge 3 commits intotimber:masterfrom
Closed
Conditional eager-loading of post meta values#2012aj-adl wants to merge 3 commits intotimber:masterfrom
aj-adl wants to merge 3 commits intotimber:masterfrom
Conversation
- Allow the user to stop eager loading by returning `null` or `false` via timber_post_get_meta_pre filter. - Allow the user to choose what to eager load by returning an array of k/v meta
- Test for 'short circuit' where no meta should be eager loaded - Test for custom list of eager-loaded post meta
This comment has been minimized.
This comment has been minimized.
Member
|
@gchtr has been working on re-writing meta value handling in 2.x, so I'm gonna let him take this from here on how to best pull this (or its ideas) in |
Member
|
Hey @aj-adl, I just opened #2014 to match the behavior that I added in 2.0. Turns out that you would approach this the same way as I would do it 👍. I think we’ll leave the name as it is. You’ll have to update the filter to the new name |
jarednova
added a commit
that referenced
this pull request
May 31, 2019
Ref #2012 – Update skipping get_post_meta() to match behavior in 2.0
Member
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.
Ticket: Fixes #2011
Issue
Allows the user to control what post meta values get eager-loaded into
\Timber\Post->customSolution
Supports both disabling, and conditional loading
Impact
This filter currently cannot affect how the parent function of
get_post_customruns. There is a potential issue if people have been hooking into here to perform some action, and returned null / void etc as previously the return value had no effect. I doubt many people are getting that into the guts of Timber, but it is something to be consideredUsage Changes
Allows the user to return
falseornullto stop the eager-loading, or return an array of$key => $valuewhich will then be processed and imported into theTimber\Postor derivative object.Considerations
naming? not suer how this looks in 2.0, seems like some changes there
Testing
Unit tests included and passing in
tests-timber-post.php