Same issue đ I am trying to pull in ACF Taxonomy field but it will not show – only returns null values.
i used this solution to solve that without using the ACF options:
function val_update_prodotto_rewrite_rules() {
$args = get_post_type_object(‘prodotto’);
$args->rewrite = array(
‘slug’ => ‘prodotti/%categoria-prodotto%’,
‘with_front’ => false
);
register_post_type(‘prodotto’, $args);
}
add_action(‘init’, ‘val_update_prodotto_rewrite_rules’);
function val_custom_post_type_permalink($post_link, $post) {
if (‘prodotto’ === $post->post_type) {
$terms = wp_get_object_terms($post->ID, ‘categoria-prodotto’);
if ($terms) {
return str_replace(‘%categoria-prodotto%’, $terms[0]->slug, $post_link);
}
}
return $post_link;
}
add_filter(‘post_type_link’, ‘val_custom_post_type_permalink’, 10, 2);
function val_update_categoria_prodotto_rewrite_rules() {
$args = get_taxonomy(‘categoria-prodotto’);
$args->rewrite = array(
‘slug’ => ‘prodotti’,
);
register_taxonomy(‘categoria-prodotto’, ‘prodotto’, $args);
}
add_action(‘init’, ‘val_update_categoria_prodotto_rewrite_rules’);
yes i just did that but the result is the same, after the changes if i go on the taxonomy page the url is correct but the page is a 404
And once again I answer myself đ
I forgot the $post_id inside the acf-field. This is how it works perfectly:
function update_post_taxonomy( $post_id ) {
$myfield = get_field('my_field_name', $post_id);
if( $myfield ) {
wp_set_object_terms($post_id, 'myterm', 'mytaxonomy', true);
} else if ( empty( $myfield ) ) {
wp_remove_object_terms( $post_id, 'myterm', 'mytaxonomy', true );
}
}
add_action( 'acf/save_post', 'update_post_taxonomy', 10 );
No, is not working.
If i use a CSV like this:
Title;Relationships;Taxonomies
Test;651,649;18,19
The element created have only the first Relationship with 651 post but not the second one 649.
And have only the first taxonomy selected 18 but not the second one 19
I’m not understanding what the wp-ultimate-csv-importer does with the pro version to import that kind of fileds.

Given the information provided, if I was building something like this I would not be using a repeater to list all of the shops in a mall. I would:
Have a CPT for Malls, each mall would be a different post in this post type
Have a CPT for the stores/shops/whatever you want to call it. Each store would have it’s own post.
There would be a one-to-many bidirectional relationship between the mall and the stores. A post object field on the store post to select the mall and a relationship field on the mall post to select the stores in that mall. I would use my plugin to create this bidirectional relationship because it is beyond what the ACF relationship field can do.
I would have a custom taxonomy for selecting the type of store/shop/whatever
I would have a value in the store to indicate what floor the store is on.
If the same operator can be located in multiple malls I would also have a custom post type for this with a one-to-many relationship between the operator and store post types.
Because you are using Elementor, I would be using Elementor Pro’s theme builder and/or templates to build the templates for showing pages on this site. Using the post widget using a custom query to show the archive pages of of the various post types.
Like, through a custom taxonomy I have added this under-category which I can add stuff to. But I cannot in the documentation see what code to use to filter for “uses this taxonomy”. Is it a category? a product type?

Hi! Thank you!
However, I think I might have worded the questions wrong.
I’m working with code. On the front page for instance, I want to have a section which shows all of the names & images of all of my authors. How do I tell to pull of everything that is classified as this specific taxonomy?

How you do this depends on how you are building. If you are building a theme yourself then you need to add a template for “taxonomy-{$taxonomy}.php”, see WP Template Hierarchy.
If you are using a page builder then you need to see the documentation for that page builder for building an archive template.

Preventing this would be complicated.
You would need to add custom javascript to ACF and use the ACF JS API select2_ajax_data filter and include the values selected in the other fields to the AJAX request and then use an acf/fields/taxonomy/query or acf/fields/taxonomy/wp_list_categories filter to alter the the terms that are returned by the AJAX request for each field.

The only way to do that would be to have 3 different queries for posts based on the terms selected in each of the taxonomy fields.
Thank you @hube2 , that’s completely true!
In the meantime I found a solution that works for me. If anyone else needs it:
function update_post_taxonomy( $post_id ) {
$myfield = get_field('my_field_name');
if( $myfield ) {
wp_set_object_terms($post_id, 'myterm', 'mytaxonomy', true);
}
add_action('acf/save_post', 'update_post_taxonomy', 20);
Cheers!

If you are using the gutenberg editor then this is a know issue. Field groups will not automatically update based on taxonomy term selection and the post must be updated to trigger ACF to show the correct field group. The same is probably true when setting a default term for a post.
In your loop template, use the get_field() function to retrieve the custom field values for each term in the âproduct_categoriesâ taxonomy. Here is an example code snippet:
<?php
$terms = get_terms( array(
'taxonomy' => 'product_categories',
'hide_empty' => false,
) );
foreach ( $terms as $term ) {
$name = get_field( 'c_name', $term );
$image = get_field( 'c_image', $term );
if ( $name ) {
echo '<h2>' . esc_html( $name ) . '</h2>';
}
if ( $image ) {
echo wp_get_attachment_image( $image, 'thumbnail' );
}
}
?>
This code snippet retrieves the âc_nameâ and âc_imageâ custom field values for each term in the âproduct_categoriesâ taxonomy and displays them in the loop.
Ok i find solution i must append this popup before my offcanvas. So with this code $(â#acf-popupâ).prependTo(â.offcanvasâ) solve my problem in class-acf-field-taxonomy.php

It does not appear that this is a feature of ACF CPTs. You’ll need to contact the developer to see if they plan to add this https://www.advancedcustomfields.com/contact/
For now you would need to add action on the registered_post_type (https://developer.wordpress.org/reference/hooks/registered_post_type/) hook and call https://developer.wordpress.org/reference/functions/register_taxonomy_for_object_type/ in functions PHP on the registered_taxonomy hook.
I’m using the acf_form() function to allow certain users to submit data to my website (new articles).
https://support.advancedcustomfields.com/forums/topic/define-a-default-taxonomy-radio-button/ geometry dash scratch
Un grand salut aussi đ
Au cas oĂš dâautres personnes rencontrent le meme problème on continue en Anglais ? đ
I am definitely not a coder/dev and since the latest release of ACF what I am trying, or anyway, achieved so far, has been done without a single bit of code.
My bad, I forgot to specify that I am also using Elementor.
But here is what I have done:
I have created a new taxonomy:
https://prnt.sc/SblxWOHBmACi
https://prnt.sc/QpWKI3Qa41-S
https://prnt.sc/A8kIAtrZXW6m
Salut aussi !
Au cas oĂš dâautres personnes rencontrent le meme problème on continue en Anglais ? đ
I am definitely not a coder/dev and since the latest release of ACF what I am trying, or anyway, achieved so far, has been done without a single bit of code.
My bad, I forgot to specify that I am also using Elementor.
But here is what I have done:
I have created a new taxonomy:
Salut aussi !
Au cas oĂš dâautres personnes rencontrent le meme problème on continue en Anglais ? đ
I am definitely not a coder/dev and since the latest release of ACF what I am trying, or anyway, achieved so far, has been done without a single bit of code.
My bad, I forgot to specify that I am also using Elementor.
But here is what I have done:
I have created a new taxonomy:
https://prnt.sc/SblxWOHBmACi
https://prnt.sc/QpWKI3Qa41-S
https://prnt.sc/A8kIAtrZXW6m
Salut aussi !
Au cas oĂš dâautres personnes rencontrent le meme problème on continue en Anglais ? đ
I am definitely not a coder/dev and since the latest release of ACF what I am trying, or anyway, achieved so far, has been done without a single bit of code.
My bad, I forgot to specify that I am also using Elementor.
But here is what I have done:
I have created a new taxonomy:
https://prnt.sc/SblxWOHBmACi
https://prnt.sc/QpWKI3Qa41-S
https://prnt.sc/A8kIAtrZXW6m
And here is what I did in Elementor:
https://prnt.sc/kQmfuTbvomh1
So it definitely loads something correct, which is the ID of the taxonomy:
https://prnt.sc/2gf4eFlbn8tv
In this case 59
But even if I switch the value as showed in my original post this is still the ID and not the value/term that is showing up.
It works fine with ânormalâ fields:
https://prnt.sc/X–0v2gyJDCc
https://prnt.sc/GwSsYtf4DpfC
But I know this is not the same thing as Taxonomies.
And I am a bit stuck :-/
Salut aussi !
Au cas oĂš dâautres personnes rencontrent le meme problème on continue en Anglais ? đ
I am definitely not a coder/dev and since the latest release of ACF what I am trying, or anyway, achieved so far, has been done without a single bit of code.
My bad, I forgot to specify that I am also using Elementor.
But here is what I have done:
I have created a new taxonomy:
https://prnt.sc/SblxWOHBmACi
https://prnt.sc/QpWKI3Qa41-S
https://prnt.sc/A8kIAtrZXW6m
And here is what I did in Elementor:
https://prnt.sc/kQmfuTbvomh1
So it definitely loads something correct, which is the ID of the taxonomy:
https://prnt.sc/2gf4eFlbn8tv
In this case 59
But even if I switch the value as showed in my original post this is still the ID and not the value/term that is showing up.
It works fine with ânormalâ fields:
https://prnt.sc/X–0v2gyJDCc
https://prnt.sc/GwSsYtf4DpfC
But I know this is not the same thing as Taxonomies.
And I am a bit stuck :-/
I even asked chatgpt to write me a code snippet which looks that it could have done something (I even asked the function to check on a specific url) but it still doesnât work đ
Salut aussi !
Au cas oĂš dâautres personnes rencontrent le meme problème on continue en Anglais ? đ
I am definitely not a coder/dev and since the latest release of ACF what I am trying, or anyway, achieved so far, has been done without a single bit of code.
My bad, I forgot to specify that I am also using Elementor.
But here is what I have done:
I have created a new taxonomy:
https://prnt.sc/SblxWOHBmACi
https://prnt.sc/QpWKI3Qa41-S
https://prnt.sc/A8kIAtrZXW6m
And here is what I did in Elementor:
https://prnt.sc/kQmfuTbvomh1
So it definitely loads something correct, which is the ID of the taxonomy:
https://prnt.sc/2gf4eFlbn8tv
In this case 59
But even if I switch the value as showed in my original post this is still the ID and not the value/term that is showing up.
It works fine with ânormalâ fields:
https://prnt.sc/X–0v2gyJDCc
https://prnt.sc/GwSsYtf4DpfC
But I know this is not the same thing as Taxonomies.
And I am a bit stuck :-/
I even asked chatgpt to write me a code snippet which looks that it could have done something (I even asked the function to check on a specific url) but it still doesnât work đ
function convert_taxonomy_ids_to_terms( $value, $post_id, $field ) {
if ( ! $value ) {
return $value;
}
if ( strpos( $_SERVER[‘REQUEST_URI’], ‘/listing-des-animaux/’ ) !== false ) {
$taxonomies = get_object_taxonomies( ‘animaux’ );
if ( is_array( $value ) ) {
$text_values = array();
foreach ( $value as $id ) {
foreach ( $taxonomies as $taxonomy ) {
$term = get_term_by( ‘id’, $id, $taxonomy );
if ( $term ) {
$text_values[] = $term->name;
}
}
}
return implode( ‘, ‘, $text_values );
} else {
foreach ( $taxonomies as $taxonomy ) {
$term = get_term_by( ‘id’, $value, $taxonomy );
if ( $term ) {
return $term->name;
}
}
return $value;
}
} else {
return $value;
}
}
add_filter( ‘acf/format_value/type=taxonomy’, ‘convert_taxonomy_ids_to_terms’, 10, 3 );
Struggling with WooCommerce product filtering using taxonomies (“Model” and “Model Year”). The system fails to distinguish between models and assumes incorrect associations with model years.
Solutions:
Hierarchical Taxonomies:
Make “Model” taxonomy hierarchical.
Custom Taxonomy Structure:
Combine “Model” and “Model Year” into a single custom taxonomy.
ACF Relationship Field:
Use ACF Relationship field for flexible relationships.
Custom Meta Fields:
Implement custom meta fields for precise data control.
Custom Search Filters:
Build custom search queries considering both taxonomies.
Custom Code for Plugin:
Customize the Search & Filter plugin for specific taxonomy handling.
Developer Assistance:
Seek help from a developer for complex customizations.
@fzs, thanks for your bug fix inspiration!
Somehow in WP 6.4.2 it didn’t work for me.
When I removed $taxonomy->meta_box_cb === false it worked, but for all categories on all post types.
But since I only want to hide a specific custom category, I simply replaced it with $taxonomy->name === 'event-category'.
So the final modified version is this:
add_filter( 'rest_prepare_taxonomy', function( $response, $taxonomy, $request ) {
$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
// Context is edit in the editor
if( $context === 'edit' && $taxonomy->name === 'event-category' ){
$data_response = $response->get_data();
$data_response['visibility']['show_ui'] = false;
$response->set_data( $data_response );
}
return $response;
}, 10, 3 );
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.