Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function acf_load_my_load_cat($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)) {
- // this repeater do not already has a value, change it
- foreach ( $categories as $category ) {
- $value [] = array(
- 'field_5cd186302ef1c' => $category->name);
- }
- };
- return $value;
- };
- add_filter('acf/load_value/name=villes_a_ajouter_III', 'acf_load_my_load_cat', 10, 3);
- function acf_load_my_load_cat($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)) {
- // this repeater do not already has a value, change it
- foreach ( $categories as $category ) {
- $value [] = array(
- 'field_5cd186302ef1c' => $category->name);
- }
- };
- return $value;
- };
- add_filter('acf/load_value/name=villes_a_ajouter_III', 'acf_load_my_load_cat', 10, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement