meta_query orderby sort multiple keys
meta_query orderby sort multiple keys
meta_query orderby sort multiple keys
You can’t change some user meta fields using edit_user_profile_update hook, because it is triggered before processing data from the form. So, you save user’s meta to database, then edit form is processed and WP overrides your values. This hook is triggered after each profile edit. You should use insert_user_meta filter (available since WP v4.4) to … Read more
So combined with that code for setting the value before it’s inserted in the db, you also need to add this code to add the post ID to an array stored in the user’s meta (after it has been updated): add_action( ‘wp_insert_post’, ‘smyles_update_user_products’, 10, 3 ); function smyles_update_user_products( $post_ID, $post, $update ) { if ( … Read more
wp_get_current_user Not working
If I understood your question correctly, you want to display this data on a page on front-end. In this case you can either create a page template in your theme folder OR create a shortcode in functions.php. Here is a quick shortcode that may help. add_shortcode(‘currentuser’, ‘shortcode_current_user’); function shortcode_current_user($atts){ ob_start(); $current_user = wp_get_current_user(); echo ‘<table>’; … Read more
First get the data $data = get_user_meta( $user_id, ‘service_name’, true); You find an array of all entries in $data. You can do it this way: <input type=”checkbox” name=”service_name[]” value=”Architecture” <?php echo in_array(‘Architecture’, $data) ? ‘checked’ : ”); ?>>Architecture<br> Untested, but should work.
This how my stored data function is for this meta group and get data stored $certification = array( ‘course_id’ => $certificate_id, ‘course’ => $certificate, ‘date’ => $date, ‘instructor’ => $certifying_instructor, ‘school’ => $school, ‘last_update’ => date(‘d-m-Y’), ); add_user_meta( $user_ids, ‘certifications’, $certification ); and this get data $users_detail = get_user_meta($user_id); $certificates = $users_detail[‘certifications’]; $n_course_id = array(); … Read more
Eventually came to a solution in case anyone needs it: function mb_get_user_meta_values( $mb_user_meta_key ) { if( empty($mb_user_meta_key) ) return; $mb_get_users = get_users( array( ‘meta_key’ => $mb_user_meta_key ) ); $mb_user_meta_values = array(); foreach( $mb_get_users as $mb_user ) { $mb_user_meta_values[] = get_user_meta( $mb_user->ID, $mb_user_meta_key, true ); } $mb_user_meta_values = array_unique( $mb_user_meta_values ); return $mb_user_meta_values; } Then I … Read more
I’m not entirely clear on what you’re trying to do, but it seems you want to pass the user’s email address via a query string and determine the user by that. You can get the user’s ID for writing user meta values from the email value. Use the function get_user_by() to retrieve the user object … Read more
How Can I Display the Last Modified Date for User Profiles on WordPress?