Skip to content

Instantly share code, notes, and snippets.

@hkitago
Last active September 30, 2022 05:33
Embed
What would you like to do?
Get user description for WordPress Shortcodes
// use [user_description] in a block, get $user_ID echo '<script>console.log("'.$user_ID.'")</script>'; in function.php before.
function get_user_description() {
$user_ID = get_current_user_id();
return get_user_meta({$user_ID}, 'description', true);
}
add_shortcode('user_description', 'get_user_description');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment