Timeline for How to retrieve all meta data directly from the $post object? Such as $post->related_topics?
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 1, 2019 at 6:21 | vote | accept | Brian | ||
Nov 1, 2019 at 1:35 | answer | added | Jess_Pinkman | timeline score: 0 | |
Oct 31, 2019 at 23:51 | comment | added | Jacob Peattie |
The post object is only going to return what you put into it. You're using get_post_meta() to get the data you're putting into it, so that's really what you should be asking about.
|
|
Oct 31, 2019 at 17:06 | history | edited | Brian | CC BY-SA 4.0 |
added 282 characters in body
|
Oct 31, 2019 at 17:04 | comment | added | Brian | When you have custom fields as meta data where the field has an id of the post you can get the data in the way I mention. Just learned about it yesterday. See here: stackoverflow.com/questions/19640850/… In my case, I have a related_topics meta field and for the post in question there are 4 related topics. But $post->related_topics is only returning one item. | |
Oct 31, 2019 at 14:52 | comment | added | Jacob Peattie |
$post->related_topics is not a standard field on the WP_Post object (the post object only contains the data from the wp_posts table). Are you adding this?
|
|
Oct 31, 2019 at 13:40 | history | asked | Brian | CC BY-SA 4.0 |