2 votes
Accepted

How to pull all the contributer users records and order by Designation (which is users meta data)?

I got the answer after went through WP_User_Query documentation. Following is the final query: $args = [ 'role__not_in' => 'Administrator', 'meta_key' => 'designation', 'meta_query '=...
user avatar
2 votes
Accepted

get_the_author_meta( $field, 0 ) returns the administrator $field

Directly on the question - no, the get_the_author_meta() function is not supposed to return you by default the birthday date when you provide 0 for user ID, as it is not a default user meta field. Yet,...
user avatar
  • 564
2 votes
Accepted

cannot get user_registered date from get_user_meta

user_registered is not a meta field, it is a field in the users table. Try: $register_date = $user->user_registered;
user avatar
  • 4,900
1 vote

Where to Store Custom User Fields

I know this question is very old, but I wanted to share my experience with working with large databases and storing custom user data. Basically wp_usermeta is the default and easiest option to store ...
user avatar
  • 146
1 vote

How can I sort get_users() by any value (last_name, user defined fields and more)

As for the examples: the mentioned $your_users = get_users('orderby=meta_value&meta_key=user_registered'); will not work, since user_registered is NOT in user_meta table (therefore no meta_key and ...
user avatar
1 vote
Accepted

How to add fields in custom registration form, validate it and aave to db?

To modify the theme's registration would be possible, but definitely not recommended. It is likely that you would only be able to add your additional fields by directly modifying the theme files, ...
user avatar
  • 86
1 vote
Accepted

Users table missing from Database

Oh, dear! Never mind! There really IS a wp_users table. I just realised that there is a second page to the list. My wp_users table was at the top of the second page of the navigation panel! I have ...
user avatar
  • 115
1 vote
Accepted

How to update and save user metadata on page visits?

There are lots of actions you can hook into to do this, I think the best once to use would be wp or template_redirect. Using either of those actions the code would be like this, this code goes into ...
user avatar
1 vote
Accepted

ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?

New answer I now have a better understanding of the question thanks to OPs comment and have come up with the following. Not tested! global $wpdb; /** * @var string $field The flexible content field ...
user avatar
  • 578
1 vote
Accepted

ACF: How to get the full field name (meta_key) by a field key?

There's a few ways to achieve this but here's one which supports an unknown depth of children, for example where you have nested groups within groups. Given the field key "field_{some_hash}" ...
user avatar
  • 16k
1 vote

Fetch user related data

try this: get_user_meta ($user->ID, 'CUSTOM-META-FIELD-NAME');
user avatar
  • 450
1 vote

Fetch user related data

I use this function on functions.php in all my development websites function imp($a){ echo '<pre>'; print_r($a); echo '</pre>'; die(); } now just use imp($user); where you are ...
user avatar
1 vote

Associate multiple email addresses with the same user account, so they can log in with either

If you create them programmatically, you could set it up so that all of the usernames are one type of email address (business or personal) and the WP email address field contains the other type. It's ...
user avatar
  • 8,683
1 vote
Accepted

last_name + first_name orderby with meta_query [solved]

To do this you need to use named meta query clauses according to the official developer docs for WP_Query: ‘orderby’ with multiple ‘meta_key’s If you wish to order by two different pieces of postmeta ...
user avatar
  • 52.5k
1 vote
Accepted

Getting users with a specific meta data and then querying their posts?

Note that here: $posts = new WP_Query, the $posts is not an array of posts and instead, it's an object. So instead of doing the foreach and setup_postdata(), you should just use the while ( $posts->...
user avatar
  • 32.1k
1 vote
Accepted

Combining wp_list_authors with get_user_meta

What you want is not supported by wp_list_authors(). To output them the way you want you will need to use get_users() and display them yourself. $authors = get_users( array( 'orderby' =>...
user avatar
1 vote

Wordpress update_user_meta onclick button with Ajax

Here is my oun answer, hope some can someone help with this. I add a comments in code <script> //Now this windows.addEventListener, don't Work at All. I need some like this, when the user came ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible