Support

Account

Home Forums General Issues Taxonomy user ID

Solving

Taxonomy user ID

  • 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.

  • Looking at the settings you are returning an array of term IDs. What is it that you want to show on the profile page for this field?

  • The taxonomy that is in the category. So I have a category called Europe and people can select beer, wine etc. And then I want to have this displayed under their interests.

  • 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/

  • Yea, I am a bit lost on how to call those selected taxonomy terms.

    <?php echo get_the_title( $research_interests->ID ); ?> displays the last topic that user wrote. So I am getting somewhere but not where I should be :-p

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Taxonomy user ID’ is closed to new replies.