Hi @morris373
You can use the Pods object or use WordPress’s core functions:
get_post_meta():
https://developer.ww.wp.xz.cn/reference/functions/get_post_meta/
For Pods functions see: https://pods.io/docs/code/pods/display/
Sorry about the older documentation page, this part isn’t migrated yet.
Personally I prefer to use WordPress’s core functions are these will always be valid.
Cheers, Jory
Hi Jory
I have tried:
$clergy_role = get_post_meta( $id, 'name', $single=true);
$clergy_role = get_post_meta( $id, 'clergy_role', 'name', $single=true);
$clergy_role = get_post_meta( 'clergy_role', 'name', $single=true);
Can’t get anything to work.
Reverend Robert Williams
Morris
Hi @morris373
That is because the code you are using is incorrect. Please read the WordPress documentation thoroughly (this isn’t Pods anymore, it’s WordPress and general PHP code).
Also see the user contributions/examples: https://developer.ww.wp.xz.cn/reference/functions/get_post_meta/#user-contributed-notes
You cannot pass a variable with an assignment like $single=true. You should just use true.
Also, did you properly get the ID of the object you are trying to fetch the field from?
Something like get_the_ID() if you are in a loop.
Cheers, Jory
Hi
This is why I am confused, I’m use to doing it 1 way and whilst using Pods, I have been shown another way.
No doubt the code has come from your Pods documentation, even the code in the table has a typo so very confusing. That is my next nightmare to solve as I am getting no records back when there’s 14 in the database.
$clergy_role = get_the_term_list( $post->ID, 'clergy_role', '', '', );
$clergy_role = strip_tags( $clergy_role );
This is how I got the term associated with a Taxonomy on my other main website. The extra line removes the link as I don’t need it.
Morris