Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save champsupertramp/476d0fc684b58c3544d28f286897dd5f to your computer and use it in GitHub Desktop.
Save champsupertramp/476d0fc684b58c3544d28f286897dd5f to your computer and use it in GitHub Desktop.
Ultimate Member - User Shortcode - conditional displaying of meta value
add_filter('um_user_shortcode_filter__country', 'um_091223_user_shortcode_country' );
function um_091223_user_shortcode_country( $value ) {
$current_logged_user_id = get_current_user_id();
um_fetch_user( $current_logged_user_id );
if( um_user('country') ) {
return $value; // returns the country of the current viewing profile when the current logged-in user's country is not empty
}
return ''; // otherwise return empty
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment