I’ve been playing around with ACF for a month now and really enjoy. I am also getting the hang of it but still need some more practice. I’ve been creating a custom profile for users and all is going great. So I added text fields, link fields and multi-select fields. They all show up in when editing a profile, and in the admin section when viewing a user. And I get all of them printed on the public profile page except for one. And for the love it, I am missing something so any tips are welcome. It involves a multi-select field that allows users to select terms to be added to their profile.
Some info from ACF
array( 'key' => 'field_5e3a86a6d3594', 'label' => 'Research Interests', 'name' => 'research_interests', 'type' => 'taxonomy', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array( 'width' => '', 'class' => '', 'id' => '', ), 'taxonomy' => 'category', 'field_type' => 'multi_select', 'allow_null' => 1, 'add_term' => 0, 'save_terms' => 0, 'load_terms' => 0, 'return_format' => 'id', 'multiple' => 0, ),
The code I use for displaying the selected fields is as follows:
<?php $author_id = get_the_author_meta('ID'); ?>
<?php $research_interests = get_field('research_interests', 'user_'. $author_id ); ?><?php echo $research_interests; ?>
I tried different approaches and read some other posts. Now I get “Array” to be displayed but that is it. Any help is welcome.
I’m still a little confused about what you want to show. Have you looked at the code examples for showing term values https://www.advancedcustomfields.com/resources/taxonomy/
You must be logged in to reply to this topic.
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!
© 2023 Advanced Custom Fields.