Just another Ultimate Member tips for your site – a road to a powerful membership website!

If you want to make specific profiles show at the very first results as pinned profiles in Member Directory, you can try this approach in 3 easy steps!

  1. Add the following code snippets to your Theme’s function.php file or via Code Snippet plugin.
add_filter("um_prepare_user_query_args","um_custom_prepare_user_query_args", 9999 );
function um_custom_prepare_user_query_args( $args ) {
	
	$args['meta_query'][ ] = array(
			'relation' => 'OR',
		   	'featured_clause' => array(
				'key' => 'is_featured',
				'value' => '1',
				'compare' => '='
		   	),
		   	array(
				"key" => 'is_featured',
				"compare" => "NOT EXISTS"
		   	)
	);

	$args['orderby'] = array(
		'featured_clause' => 'ASC',
		
	); 

	return $args;
}

2. Add a new Dropdown field and enter the Meta Key is_featured in the Profile Form via UM Form Builder. Set the field Privacy to Administrator role so that only Admins can make the changes to this field when editing a Profile in front-end. Dropdown choices should be 1 and 0.

3. Try editing a profile and set the Is Featured profile to 1. Hit on Update to save the changes made to the profile.

And the profile should show up in the Member Directory as first featured profile!


Let me know if this works for you! Leave some good vibes in the comment and don’t forget to subscribe to my newsletter to get weekly WordPress & Ultimate Member tips for your site!

Subscribe to my newsletter!

3 CommentsClose Comments

3 Comments

  • Swapnil
    Posted August 21, 2020 at 1:32 am 0Likes

    Very nice
    Pl help me to increase profile photo size in member directory

    • Posted September 1, 2020 at 2:09 am 0Likes

      Hi Swapnil, Have you tried adding a profile size in the Upload settings? Please go to WP Admin > Ultimate Member > Settings > General > Uploads?

  • Emer Kelly
    Posted January 20, 2022 at 10:52 pm 0Likes

    Hi, thanks for this tutorial! I tried it and it’s working but with a weird twist. If I set the value to 1, the member is featured, so that’s great. But if I then want to un-feature them, and I set the value to 0, they disappear from the listing entirely. E.g. this user on my site: https://seausrise.org/user/dave+michael/. He can’t be found in any of the directories. Any tips on how to solve this? Thanks!

Leave a comment