Skip to:
Content
Pages
Categories
Search
Top
Bottom

Create xprofile multi select field via code


  • linguabuddy
    Participant

    @linguabuddy

    Hi there,

    I need to create an xProfile multi-select field that maps to the tags in use on the site. I know how to fetch the tags, but I am not sure how to create and configure the appropriate field type via code.

    
    //Fetching tags for more responsiveness
    	$tags            = get_tags(
      		array(
        		'orderby'    => 'name',
        		'hide_empty' => true,
      		)
    	);
    	$tag_field_values = array();
    	foreach ( $tags as $tag ) {
      	$tag_field_values[ $tag->name ] = $tag->name;
    	}
    

    Which functions / actions would I then use to create the BuddyPress profile field using the $tag_field_values variable as the field’s select list?

    Does anybody have a worked example I can follow?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar