I have a custom user field in the standard database, called “company”.
I want to output on to a page the usermeta info only of users whose “company” matches “Widgets Inc” …
How do I do that?
What I think I’d like to be able to do is avoid putting this in a page template and instead create a shortcode to list user info, with functionality to limit by field attribute – ie. {listusers company=”Widgets Inc”}
But I don’t know how to do that.
Thanks
Try this one
And here is your short code
[list-company-users]
To define to use parameters in short code you can do like this
Now you have to extract the values passed in shortcode via
shortcode_atts()
References
Create a Shortcode
WP_User_Query