How to display current_user bio

You probably want to use wp_get_current_user to find out which user is browsing the site. $current_user = wp_get_current_user(); echo ‘User ID: ‘ . $current_user->ID . ‘<br />’; From there you’ll use the ID to pull the user’s metadata with get_user_meta. $all_meta_for_user = get_user_meta( $current_user->ID ); echo ‘User Description: ‘ . $all_meta_for_user[‘description’] . ‘<br />’; The … Read more

How to set show admin bar front to true for all users?

You can use update_user_option() function (see codex) Your loop looks fine to me, so probably this would work: // Create the WP_User_Query object $wp_user_query = new WP_User_Query(array(‘role’ => ‘Subscriber’)); // Get the results $users = $wp_user_query->get_results(); // Check for results if (!empty($users)) { // loop trough each author foreach ($users as $user) { // update … Read more

Hide menu item based on user’s custom capability

This plugin provides filter to manage the menu item by meta value: function custom_menu_item_visibility( $visible, $item ){ if( isset( $item->roles ) ){ $user_id = get_current_user_id(); $user_meta = get_user_meta( $user_id, ‘your-meta-key’, true ); if ( /* your condition */ ){ $visible = true; } else { $visible = false; } } return $visible; } add_filter( ‘nav_menu_roles_item_visibility’, … Read more

Uncheck the box “Send User Notification” by default on new-user.php

There does not seem to be an easy overwrite without replicating the whole user interface. So the quickest solution might be to un-check the checkbox via JavaScript: add_action(‘admin_footer’, ‘uncheck_send_user_notification’); function uncheck_send_user_notification() { $currentScreen = get_current_screen(); if (‘user’ === $currentScreen->id) { echo ‘<script type=”text/javascript”>document.getElementById(“send_user_notification”).checked = false;</script>’; } } The script is only injected on the user-new.php … Read more

Update user meta through a front end form

There are 3 main issues in your code: I see you’re using current_user_id() which does not exist in WordPress, so I believe that should be get_current_user_id(). Your update_basic_user_meta() function basically would work in updating the user’s metadata, but you need to check whether the POST data (gender and specialty) are actually set before proceeding to … Read more