To fetch users with certain meta field, you can use WP_User_Query
class. Check codex manual for it.
So you can create a custom shortcode like this:
add_shortcode( 'listusers', 'wpse8170_listusers' );
function wpse8170_listusers( $atts, $content="" ) {
$atts = shortcode_atts( array( 'company' => false ), $atts );
if ( empty( $atts['company'] ) ) return $content;
$query = new WP_User_Query( array(
'meta_key' => 'company',
'meta_value' => $atts['company'],
) );
ob_start();
// render your users list here
return ob_get_clean();
}
Related Posts:
- How to display the names of users from a specific group with a shortcode?
- How to display some selected user meta data on a specific page with a shortcode?
- Register visits of my pages in wordpresss
- create shortcode to list users with specific meta key value
- Create a shortcode that creates a form for users to edit their information
- Shortcode to update user meta
- Change user meta value with shortcode
- Parsing a shortcode through an author meta textfield
- SImple Example To Update User Info From Front End [duplicate]
- How to insert current user ID/entry ID into a shortcode?
- How to display content if user meta data isn’t empty with shortcode
- How to display total user count by specific role in WordPress as statistics?
- Display current user metadata on WordPress page
- shortcode display metainformation as linked image
- How to avoid one code multiple times instead do that through some function? Shortcode, but I think shortcode is not used in main theme’s core files?
- Check if Page=current user page via shortcode
- Shortcode for displaying the user’s first name?
- Conditionally Loading JavaScript/CSS for Shortcodes
- shortcodes output before content [duplicate]
- How to get users by a custom field / by user meta data?
- WordPress adds br in between my shortcode
- Wp_User_Query not sorting by meta key
- Shortcodes, HTML tables, and multiple rows
- Does a shortcode with a single attribute have to use an array?
- Show User Their Password
- How navigation works in custom loop within shortcode?
- Use [shortcode=”value”] instead of [shortcode att=”value”]?
- How can I sort get_users() by any value (last_name, user defined fields and more)
- I dont want to show shortcode in tag
- Post loop created via shortcode not displaying shortcode in content
- Pass shortcode variables to template
- Is it possible to add a repeater field to TinyMCE’s option window?
- Shortcodes: Pros and Cons
- esc_attr not working in shortcode
- Raw output (preventing wpautop)
- Can’t understand $atts in functions?
- Are .MP3 files with capital letter extensions allowed in [audio] shortcode?
- How to handle shortcodes when using the JSON API
- Are shortcode functions applied while rendering the content, or are they executed and stored with the post content?
- Get Posts shortcode plugin and meta_query?
- Uncheck the box “Send User Notification” by default on new-user.php
- possibility to control embedded video timeline with buttons and links external to the player
- Video Shortcodes not working in WordPress
- Custom shortcode is not working in text widget
- Get post object in shortcode function
- How to insert image and text from admin panel throughout my theme
- Use shortcodes in terms description? [closed]
- Rest API code to get ID of current user not working: get_current_user_id() gives 0
- Adding to the_content or a variable from within a shortcode function
- Custom Shortcode: define cursor position/insertion point?
- How to Access wp_usermeta Data Immediately After a New User is Created
- Shortcode: text content ends up outside html tags
- My shortcode does not call the function
- Shortcode not showing anything
- return unformatted content in encosing shortcode
- How to display Feedburner subscription count as plain text via a shortcode in post/page editor of my WordPress blog?
- Shortcode in my childtheme is not working
- How to Make Archive ShortCode
- Are Shortcode Attributes Always Passed As Strings?
- Show form per shortcode
- Send admin new order email to logged in user as well
- Default WordPress shortcodes not working?
- How would I be able to use a font awesome icon as a user’s avatar?
- How to make this shortcode work for post content wordpress [duplicate]
- Pass fileurl parameter into shortcode from Advanced Custom Fields
- caption shortcode using image alt as caption
- Shortcode arguments to another shortcode
- Sanitize or treatment of string in editor via shortcode
- Toggle Shortcode Sanitize Title
- User Meta stuff
- Can’t render shortcode when html tag contains hyphen
- Not to escape a text
- How do I update user email from frontend input field?
- Color on Shortcode insert that creates a button
- shortcode doesnt work on excerpt
- Adding Author URL to Nav Menu via Shortcode
- Shortcode result appears above page content
- Pagination for custom posts loop
- Modify [caption] shortcode so and are not used?
- How to prevent multiple user accounts with the same meta field?
- How to Call Related Post based on Categories Inside Post Content with Shortcode?
- How to strip header tags & shortcodes from the_excerpt()
- Multiple shortcodes only use attributes from one of the shortcodes on custom plugin
- Cannot modify class property from shortcode handler function
- Reusable Dynamic Taxonomy Shortcode
- How do i remove Business feeds Shortcode fatal error
- Can’t place endwhile in the loop properly in a shortcode
- How to reduce the image size inside an icon? [closed]
- How to insert visual compser post grid shortcode in a custom page template? [closed]
- Shortcode tags appear on mobile themes
- Manipulated shortcode output
- Where is escaped the shortcode?
- Str_replace using shortcode with multiple changes
- Changing layout of defaul gallery output to masonry
- shortcode change variable base on user
- Inserting shortcode is blanking excerpt – any ideas?
- How to remove https:// from shortcode generated url
- How to enable on custom shortcodes
- Nested ShortCode works inside the_content, but not outside of it
- How can I list users by date in an array in meta_value?