Home › Forums › Add-ons › Repeater Field › Fill up repeater fields with category › Reply To: Fill up repeater fields with category
Thanks it help me to solve my problem (sorry for the time to answer you ^^’)
For those who want my entire code :
function acf_load_taxonomy_custom_urls_table($value, $post_id, $field){
$args = array( 'taxonomy' => 'ville_formation');
$post_categories = wp_get_post_terms( get_the_ID(), 'ville_formation', array("fields" => "ids") );
if ( !empty( $post_categories ) ) {
$args['exclude'] = $post_categories;
};
$categories = get_terms( $args );
$value=array();
if (empty($value)) {
foreach ( $categories as $category ) {
$value [] = array(
'field_5cd186302ef1c' => $category->name);
}
};
return $value;
};
add_filter('acf/load_value/name=villes_a_ajouter_III', 'acf_load_taxonomy_custom_urls_table', 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!
Make sure to register for tomorrow’s special ACF-focused edition of #BuildModeLive. Iain Poulson joins @hellosammunoz & @bgardner for a discussion about ACF’s roadmap and what’s in development. https://t.co/k93h4pYCae
— Advanced Custom Fields (@wp_acf) January 26, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.