ACF Post Object filter: guard against empty post id #407
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.
What does this implement/fix? Explain your changes.
Adds a guard against the post id when attempting to set the correct Type source for an ACF Post Object field. This guard will return the correct value (
null
) instead of an unexpected query result (incorrect/duplicate product/order/coupon).There could be instances where the post id is empty because an end-user saved an empty value in the WP admin UI. It is better to get a
null
value instead of the incorrect product/order/coupon result.For more details, see #406
Does this close any currently open issues?
#406