
You have to supply the correct post ID when calling acf function to get values from terms. See this document https://www.advancedcustomfields.com/resources/adding-fields-taxonomy-term/
Ah yes the block is wrapped inside a
<?php
$case_study_category = get_field('case_study_category');
if( ($case_study_category) ) :
?>
...
<?php endif; ?>
The field is Taxonomy (Category)
Return Value: Term ID
Screen here of field page: https://postimg.cc/D4GNVRYQ

When is add_local_field_group called, before or after “init” when the taxonomy is added. I suspect that you are attempting to get the terms in the taxonomy before the taxonomy has been initialized.
function get_terms_for_acf_select() {
$terms = get_terms(array('taxonomy' => 'teams', 'hide_empty' => false));
if (is_wp_error($terms)) {
die ('WP Error Getting Terms');
}
$options = array();
if (is_array($terms)) {
foreach ($terms as $term) {
if (is_object($term)) {
$options[$term->term_id] = $term->term_id;
}
}
}
return $options;
}

yes there is, someone else commented on this but it was marked as spam because they included a spammy link. It’s sad when people who actually have knowledge post useful information only because they want to inject a link to some unrelated site. In all likelihood these people are now generating what appears to be useful information with AI. I do not put up with spam here.
Anyway
UPDATE wp_posts SET post_type = 'dog-something' WHERE post_type = 'dog'
This should be done with caution, like backing up your DB first.
Yes, you should plan ahead. Test a little if you want, but I would not change a CPT or custom Taxonomy name after live content is added. Especially if there is a lot of posts.

I have steered you wrong.
acf/fields/taxonomy/query is used for select fields and the select field does not use wp_list_categories()
Select fields are rendered using ACF’s select field rendering, the only way to alter the title is with acf/fields/taxonomy/result, if that does not work then it is not possible.
I’m now facing exactly this same issue https://support.advancedcustomfields.com/forums/topic/add_filteracffieldstaxonomyquery-bug/#post-30884 filter is not getting called.
I’m using WP 6.4.

Not sure why you made your comment private.
Like I said, I don’t know anything about building custom walkers and I don’t know why it would not be working.
As far as my knowledge goes, when using a select field for taxonomy terms is that ACF calls wp_list_categories() and one of the filterable arguments for this function is ‘walker’.
The best I can do is tell you how to see if your filter is being called. For this turn on WP Error Logging and then call the PHP function error_log() inside of your filter and see if your messages is logged. This is the only way to tell because it is a AJAX request. Your filter will only run when you click into the field and ACF tries to load more choices.
If you want to possibly get input from someone other than me then you need to make your comment public, but it reality, your best choice for information on building a custom walker for WP is probably not this forum.

Another issue that could be causing this is that something is outputting something, and this could even be just white space, before ACF sends a response to the AJX request. Issues of this kind are extremely difficult to track down. It can be a plugin conflict or something in the theme, any filter or action that might run during the ajax request could cause it.
Another issue that could cause this is an extremely large number of terms in the taxonomy.

See my answer here https://support.advancedcustomfields.com/forums/topic/tweak-taxonomy-select/#post-163692

ACF calls the function wp_list_categories() to show a select field for taxonomy fields.
To alter the display of the select field you must build a custom walker.
You can alter the walker used by the field using the filter on acf/fields/taxonomy/wp_list_categories
$args['walker'] = new YourCustomWalkerClass();
Beyond this I can’t really help you much.
Here is one tutorial https://phppot.com/wordpress/wordpress-custom-walker/
many more can be found by searching the web for “wp_list_categories custom walker”

The correct link would be
"{$domain}/{$taxonomy_slug}/{$term_slug}/feed/"
There is not URL for categories of a specific post type
But you might be able to use
/feed/?post_type=news&category_name=featured

That is a very old example and what you are seeing is why I used select fields instead of ACF Post Object, Relationship or Taxonomy fields in that example. The only reason I created that repo was to post examples from work that I’ve actually done for clients.
Since I built that ACF has added the select2_ajax_data filter hook to the JS API. This filter can be used to get the value selected in another field and pass it to the server in ACF’s AJAX request used to populate the fields I mentioned above. You can then get that value from $_POST in one of the ACF server side query filters (acf/fields/relationship/query, acf/fields/post_object/query, acf/fields/taxonomy/query, acf/fields/taxonomy/wp_list_categories) to modify what is shown by ACF.
Unfortunately, I don’t have any examples of this because I have not found a reason to build them and would not rebuild old code unless it stops working.

This document covers getting values from a term https://www.advancedcustomfields.com/resources/adding-fields-taxonomy-term/
You are doing that incorrectly
$image_id = get_field(‘_thumbnail_id_marque’, ‘term_’ . $term_id);
you can also call this function with the term object instead of "term_{$term_id}"
This document covers using an image field https://www.advancedcustomfields.com/resources/image/
How you use it depends on what you have set as a return value for the image field. But you can always get only the ID value regardless of the return setting by setting the 3rd parameter to false
$image_id = get_field(‘_thumbnail_id_marque’, ‘term_’ . $term_id, false);
Hi,
Sorry for that misunderstanding, I’m working on woocommerce and the plugin “WP Gridbuilder”.
And a php code is exactly what I’m looking for !
So far I’ve done this :
function save_acf_image_as_featured_in_taxonomy($term_id) {
// Assurez-vous de remplacer ‘nom_du_champ_image’ par le slug de votre champ ACF
$image_id = get_field(‘_thumbnail_id_marque’, ‘taxonomy_’ . $term_id);
if ($image_id) {
// Enregistrez l’ID de l’image dans les métadonnées de la taxonomie
update_term_meta($term_id, ‘featured_image_id’, $image_id);
}
}
add_action(‘edited_ma_taxonomie’, ‘save_acf_image_as_featured_in_taxonomy’);
add_action(‘create_ma_taxonomie’, ‘save_acf_image_as_featured_in_taxonomy’);
function set_custom_card_thumbnail_for_taxonomy($object) {
// Obtenez les paramètres du grid courant.
$grid = wpgb_get_grid_settings();
// Si cela ne correspond pas à l’ID du grid 6.
if (6 !== $grid->id) {
return $object;
}
// Si l’objet est une taxonomie (ajustez ‘ma_taxonomie’ pour votre taxonomie).
if (is_a($object, ‘WP_Term’) && ‘marque’ === $object->taxonomy) {
// Obtenez l’ID de l’image ACF pour la taxonomie.
$image_id = get_field(‘_thumbnail_id_marque’, ‘taxonomy_’ . $object->term_id);
// Si un ID d’image est trouvé, affectez-le.
if (!empty($image_id)) {
$object->post_thumbnail = $image_id;
}
}
return $object;
}
add_filter(‘wp_grid_builder/grid/the_object’, ‘set_custom_card_thumbnail_for_taxonomy’);
But it’s not working…
I was poiting out the product category miniatures of woocomerce because, without any dev, it just works fine with what I’m willing to do.
Thanks.
Hello,
Thanks for your answer.
I do build on Woocommerce and it seems to me that the product category, witch is a wp taxonomy, has the featured image.
Anyway I’ve ask the gridbuilder support.
To be continued…

Hate to be a downer, but this is going to be difficult.
Given what you have you will need to do something like this: https://www.advancedcustomfields.com/resources/how-to-sorting-a-repeater-field/
I would likely have made the “Books” CPT and then used child posts to create the “Editions” and separated the custom fields between parent/child posts based on what they applied to. This way you could show child posts on the parent post CPT and you could query all child posts by the “Type” taxonomy page (template: archive-{$taxonomy}.php} to show lists of books for each type.

This will work the same way whether using blocks or not using blocks.
To summerize and make sure I’m not missing anything.
You have two fields in your group
And you want to filter the posts available for selection in the post object field by the selected term.
This is not possible without custom coding. You will need to add custom JavaScript to ACF and you will need to use the ACF JS API.
In your JS code you will need to use the select2_ajax_data hook and get the value selected in the taxonomy field and add it to the values submitted in the AJAX request.
Then in your acf/fields/post_object/query filter you will need to get this value from $_POST and use the value to alter the query done for the post object field.
You may also need to trigger a refresh of the post object field or delete any value that is already selected in the post object field if the term selected in the taxonomy field is changed. I don’t have any references on how to do this part.

Hi,
This is awesome !
Is it possible to do the same with custom taxonomy ?
because if I add page type with or without child / parent it doesn’t work as it is not a page but a taxonomy.

I still don’t understand WHAT specifically these groups are.
Or you don’t know and you are asking how someone would do this? It could be done an any one of these ways.

I don’t know what you mean by
assign them to one or more user groups
Is this an ACF field? What type of field? A user Role? A taxonomy? A post?
Unless you’re doing something special then it should be as easy as adding the field group to the WP registration form by setting the field group location rules.

I can’t tell you how to use “ACF: Better Search”. This is a plugin by another developer and I do not use it.
What I do know is that you cannot alter the “s” parameter in the WP search to include searching a post based on a taxonomy.
You would need to have a separate field that listed the terms in the taxonomy where the value submitted is the term_id for each term. Then you would need to alter the query done during the search to add a tax_query.

This has nothing to do with adding the taxonomy, you would find these settings in the taxonomy “field” when adding a field to a group. As I said, ACF cannot control what the standard WP taxonomy meta box can do. You have to remove it and use an ACF field instead.

I thought you were using moving terms from one taxonomy to another. Post values will not be affected.
In all cases the meta key is the same as the field name.
The taxonomy field has the option of using a radio button for presentation
Sorry for the dumb question, but how can this be done?
I can’t find this option in the configuration for a custom taxonomy.
In a test site, I managed to do this with the help of a third-party plugin. But I can’t see a way to do this within the ACF settings for a custom taxonomy.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.