You can make use of the meta_key
and meta_value
query arguments.
$args = [
'role' => 'author',
'number' => -1,
'meta_key' => 'yourprefix_location',
'meta_value' => 'somevalue'
];
Source: https://developer.wordpress.org/reference/classes/wp_user_query/#custom-field-parameters
Related Posts:
- How to filter users on admin users page by custom meta field?
- How to bulk delete all users with no posts?
- How can I add information underneath the user’s name on the users.php page?
- How may I filter get_users() similarly to pre_get_posts?
- how to change appearence of the content of default post list columns?
- Filter users by custom colum not meta key
- How to link the whole list item in Gutenberg’s latest posts block?
- Get current user data
- How to replace username with email address in users table
- How would I be able to use a font awesome icon as a user’s avatar?
- Register new user, assign custom role then send email
- How to pass a variable between filter/action functions?
- WP_Query filter by custom meta
- WordPress: Issue with filtering users using date range
- Custom registration field to SQL database
- How do you disable the verification process of user email changes?
- Filter and manipulate the get_current_user() function
- Changing WooCommerce Display Price Based on User Role & Category [closed]
- Not able to change wp_title using add_filter
- LESS CSS enqueue_style with add_filter to change rel attribute
- Remove Editor From Homepage
- Advanced Custom Fields and Yoast SEO keyword analysis [closed]
- What do add_filters() and apply_filter() do?
- SSL certificate for the host could not be verified
- What to use instead of the content_save_pre filter?
- How can I customize the wp_list_categories
- Removing user contact methods works from functions.php but not from a plugin
- How can I reliably and globally disable wptexturize?
- Customise Jetpack Publicize text
- Can’t change a label in woocommerce with the normal filter
- WordPress RSS feed – filter RSS content by custom field value
- What is the filter hook for custom fields content?
- Add classname to the_category() function?
- Filter the URL of next_posts_link & previous_posts_link
- Sensei LMS Hooks to Remove Content
- How to re-enable a filter after disabling with __return_false
- Exclude One Category and its Subcategories using WP_LIST_FILTER
- Explanation for remove_filter used in the below code [closed]
- How to change the blog title with add_filter? details below
- Gutenberg disable the “block” tab in right sidebar
- Where is this inline CSS code [closed]
- When to use actions and when to use filters
- add_filter to ‘woocommerce_before_main_content’ [closed]
- Editing
- the_content filter – checking the post
- add_filter to apply_filters that exists within class
- Echoing Categories only if they’re a child of a given category
- Why in archive page doesn´t show read more button with excerpt?
- Removal of Jetpack OG Tags from old blog site
- Adding a title prefix with the the_title filter
- How to removes all instances of thumbnails displayed in my theme?
- How to modify an existing meta description?
- Adding TinyMCE buttons without removing plugin buttons?
- Don’t see add_filter result in the site front page
- How can I include an existing custom sitemaps listing in wp-sitemap.xml?
- Display Externally Retrieved Data within a Custom Template
- Can the wordpress color palettes by changed through Javascript?
- Filter on the_content doesn’t update the content being searched via register_rest_route
- Where to add_filter in theme functions.php?
- tag removed not using a filter
- How to customize the “Insert/edit link” popup box?
- WordPress Image update filter
- How to remove this filter?
- Why does WordPress strip custom HTML that are form elements and theme SVG icons?
- Load Posts’ individual body content on index starting at char 200 of each post
- How can you wrap add_filter with a if is_home() statement?
- How to add attributes to WordPress Admin Sub Menu List Items
- How to combine multiple body classes
- why require – does not load filter
- term_link filter rewrite link only applying half of condition?
- How to change dynamically page title according to variable data?
- How can I filter tag_description()?
- Create a pre-filtered version of the Media Library
- What is the action hook to use if you want to capture the new password during password change?
- Get_template_part inside filter?
- How to filter Sidebar Content
- How would I use a filter to remove header banner on certain post types
- Need to return shortcode text instead of the output
- How to apply filter on get_the_post_thumbnail()
- Use alternative front page if cookie is set
- How do I check if I can use the allowed_block_types filter?
- Allow user only create specific tags
- Setting the page title in a plugin, but not outside my plugin
- how to output HTML tags in post_content and not as plain text
- Security question – Display a General Custom Login Error Message
- Action for opening attachment or manipulating all attachment links
- Remove the post_content search from WHERE clause (and CONCAT sql function)
- How to apply a filter to everything?
- WP Job Manager – display search results from custom search form in taxonomy-job_listing_category page
- Conditionally (cpt) filter previous and next_post_link
- Post filter Month dropdown at front-end like wordpress backend
- changing size image within the content
- WP Dashboard -> Posts-> Filter by Category -> Form Method Change : Which Hook
- How do I remove certain HTML elements with specific classes from the feed?
- Identify admin/logout and more filters
- Sanitizing a custom query’s clauses
- How can I display wp_link_pages before a shortcode, if it is used, or display after content?
- confusion with add_filter
- post->post_content filter
- How to create a list of terms who’s posts also have a predefined external term?