Elegant way to include only published posts with get_objects_in_term()?
Question
The obvious way is to iterate through the resulting array of IDs, get_post for each and test against post_status == 'publish'
. But I wonder whether this could cause memory issues since get_post
will attempt by default to cache each result? Short of a custom SQL join, are there any surprise args one can pass to get_objects_in_term()
or is there some other tax function I'm not leveraging that I should be?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange