Created
September 12, 2023 08:32
-
-
Save champsupertramp/476d0fc684b58c3544d28f286897dd5f to your computer and use it in GitHub Desktop.
Ultimate Member - User Shortcode - conditional displaying of meta value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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