😄Get Custom Taxonomy Field Value, acf, advanced custom fields (ok)
https://support.advancedcustomfields.com/forums/topic/get-custom-taxonomy-field-value/
Last updated
https://support.advancedcustomfields.com/forums/topic/get-custom-taxonomy-field-value/
Last updated
I have a custom Taxonomy term named ‘Campus’. I then have a custom field within that term called ‘Address’. Any suggestions on how I should best return the Address when I have the value of Campus? Im hoping to avoid a dirty sql query, then having to cache it myself so that i dont have to make a special query on each page load. This taxonomy is not related to a particular post. Nor should it need to be in my opinion. I asked this question earlier this year and I never figured it out, but since you changed forums, I cant just continue my last post or go back and check it out. =/
Just to clarify, you are asking how do you load a custom field value from a taxonomy term when you know the taxonomy type and the term ID?
Please read this documentation article: http://www.advancedcustomfields.com/resources/how-to/how-to-get-values-from-a-taxonomy-term/
I’m having the same issues. I’m using WooCommerce, WPML and ACF. WooCommerce creates a custom taxonomy called ‘product_cat’. The name of the field I’m trying to get is ‘Subscribe Field Name’.
I’m using the following, but it’s not returning anything:
<?php echo get_field('subscribe_field_name', 'product_cat_16');?>
It’s driving me crazy.
Must’ve been something with the field name. I added a new field with the name cm_id and it worked.
It’s driving me crazy but I totaly don’t understand how I can get value from custom filed that is custom taxonomy term (select). I read “How to get values from a taxonomy term” 10 times. I search all the forum with words taxonomy custom field. I don’t understand where I can get value of $TermID? <p><?php the_field(‘field_name’, ‘category_7’); ?></p> – so tell me please where are you get that “7” ? I have custom taxonomy called ‘my_taxonomy’ (I use Custom Post Types UI plugin) and I have custom field (my_field – select from taxonomy values list) in custom post (type my_post_type). So I want to post its value in frontend? Will be appreciate if you colud give the examples or the link to docs or at least turn me to the right way. 1) Get the taxonomy (one value – select or radiobutton) field value? 2) Get the taxonomy (few values – checkboxes) field array of values? 3) Get the repeater nested taxonomy field value? Thanks in advance
P.S. Sory for my bad english. May be that SQL clear what I want –
but instead of ” taxonomy = ‘where_from’ ” – value from unknown table that has relationship field_name — taxonomy_name
Hi @BLiN
You say that you have used a taxonomy field to select a taxonomy. Is this a single or multiple select field?
To get the selected taxonomy term, you use the get_field function like so:
Then,make sure you have a return format setting of ‘Object’ instead of ‘ID’.
You can then use $term to load data from the taxonomy term like so:
Thanks E
I think my problem is similar to what’s been going on here, but I’m still coming up blank.
I have a taxonomy field (checkbox, so multiple items can be chosen) inside a custom post type. So far so good. My query displays the selected taxonomies.
But within those custom taxonomy terms I’ve added a FontAwesome field, so each term has an icon associated with it.
What I’m trying to do is display all icons of terms selected within the custom post.
Here’s my code so far (like I said, the term name itself is displaying just fine, but I want the icon associated with that term to be displaying):
The link above ( http://www.advancedcustomfields.com/resources/how-to/how-to-get-values-from-a-taxonomy-term/ ) gives a 404. Based on the URL, I would really like to read that article (and I can’t find it, using Google). Any help?
Hi @zethzethdk. The article you are looking for is this one: Adding fields to a taxonomy term – https://www.advancedcustomfields.com/resources/adding-fields-taxonomy-term/
This worked for me to get the taxonomy terms for the current post with an ACF icon field attached:
Viewing 10 posts - 1 through 10 (of 10 total)
The topic ‘Get Custom Taxonomy Field Value’ is closed to new replies.