0

I would be grateful if anybody could point me in the right direction please.

I have a WordPress setup which utilises Theme My Login and https://wordpress.org/plugins/user-tags/, to allow users "tag" their user profiles from the front-end.

This works great but I am having difficulty displaying the user's selected tags when somebody is viewing their public/front-end profile.

I have the following code, which simply lists all the tags available - however I am unsure of how to alter this code so that it only lists the tags that the specific user has specified;

<?php 
     $args = array('taxonomy' => 'user_sector' );
     $categories = get_categories($args);

     foreach($categories as $category) { 
        echo '<div class="sector">'. $category->name.'</div>';
     } 
?>
1

If anybody needs to do this too - I was able to achieve this with the following code;

<?php
     $terms = wp_get_object_terms( $userid, 'user_sector' );

     foreach($terms as $term) {
         echo '<div class="sector">'. $term->name.'</div>';
     }
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.