Just like posts with WP_Query
and pre_get_posts
, there is WP_User_Query
and pre_get_users
that lets you modify the query parameters for fetching the users. This is the most efficient method of adjusting the list of users.
e.g.
add_action( 'pre_get_users', 'justin_wylllie_pre_get_users' );
function justin_wylllie_pre_get_users( \WP_User_Query $query ): void {
// ... modify the query object if we're on the relevant page
}
Related Posts:
- How to add attributes to WordPress Admin Sub Menu List Items
- Removing menus from users other than the administrator
- what is __return_false in filters
- Passing Additional Parameters to add_filter Callable
- How can I add an Author filter to the Media Library?
- Custom theme hooks / filters – passing arguments
- Change upload directory on custom plugin page
- What params are available with the_content filter?
- How to hook wp_list_pages?
- Don’t replace “|” with Empty String (“”) when generating slugs from title
- apply_filters(‘the_content’, $content) alternative
- How to use the_excerpt in a filter hook?
- Add wrapper to only youtube videos via embed_oembed_html filter function
- Changing document title only on a custom page template
- Shortcodes not resolved in AJAX call response
- Possible to filter the posts or categories that XML-RPC users see in their mobile application?
- wp_link_pages output appears twice
- user_has_cap filter allows edit but will not allow save
- Add filter to wp_dropdown_pages() or wp_dropdown_categories() – no select container?
- Hook different functions to the same filter conditionally OR Pass additional arguments to existing filter?
- How do I pass the value from a foreach loop to an add_filter function? [closed]
- Change WordPress RSS link with filter?
- Search results sorted by post types
- Pass parameter to the upload_dir filter
- Filter or Hook to catch pre-rendering of post content
- check to see if hook is available
- Use add_filter on concatenated string variable
- Filter users by custom colum not meta key
- How do I hide the current page’s title?
- How to allow users to view pending posts of a specific custom post type?
- Remove filter callback: method in class
- How can I exclude tags from category_rss function?
- How to filter meta_values using REST API
- How do I use remove_action on an add_action that uses an array?
- Admin Backend – Search Pages only by title
- How to hide Ads in between posts on AMP? [closed]
- What is the downside of using a filter as a “poor man’s” dependency injection?
- Change the default 10-day expiration for the password protected pages cookie
- Add content as soon starts
- Access get_the_title() from ‘excerpt_length’ filter
- Wrong post_status notice after wp_insert_post_data
- BBPress changing default group activity
- Comment search plugin
- How can I replace an oEmbed URL in post with actual embed HTML
- Filter the_content to add something before each element?
- How to display the content HTML of a page without displaying the gallery code as well
- Is it possible to apply_filter on a wp_ajax_ action?
- Apply filters with multiple filters
- Remove Comment Author Link only for subscribers
- Prevent reset password specific user role
- WooCommerce coupon hook argument NULL when using filter woocommerce_get_shop_coupon_data
- Create new custom field that calculates age
- How can I edit comment meta value before it is saved?
- Why current_user_can(‘edit_comment’) always true?
- Disable sanitize_file_name on upload without modifying functions.php
- Redirect after post deleted
- How to stop filter from running on the index.php page?
- Filter Shortcodes when using get_page
- Usage of filters
- Where exactly does the edit_{taxonomy} hook fire?
- How to filter with dropdown in backend for custom data
- Is there any reason for the nested filters to be applied on the first case and not in the second one?
- Filter Media by attached page or blog post in Library
- How to stop DOMDocument destroying embeds?
- Redirect an archive page to its relevant URL-friendly filtered page
- How to modify image caption in posts?
- Extend Nonce Lifetime for Specific Nonce Creation
- Run `wp_insert_post_data` on all posts
- Show uploaded pdf files dynamically and filter by month name
- How can I pass instance via apply_filters as a parameter?
- how to use substr with get_the_content()
- Consult array data in REST API Filter
- WordPress add_filter to post_date
- Add filter return false not working
- create a shortcode with acf including a filter
- How to take shortcode and content separately from a page?
- Display post after choice two taxonomy terms
- Overriding Generated Attachment Post URL
- Pagination while keeping the filters
- Apply a filter str_replace on specific caracters array in the_content()
- get_the_archive_title hook unwanted changes!
- using filters on the function from class
- Put data in my-account/view-order/id/ page
- apply_filters to $GLOBALS
- The title of an attachment is not working
- Removing a line from a WP core function (comment_template.php) – filter or other technique?
- add_filter not adding the filter
- Hide H1 Title using the_title filter
- get_the_excerpt on mobile still displays continue reading
- Filter image and text from post format
- Filter posts by multiple checkbox categories
- Remove pipe in views admin page filter
- Using two posts_orderby add_filter makes conflict
- How to correctly override a filter?
- Is there a way to check if the ‘wp_sitemaps_enabled’ is true or false?
- Block Gutenberg Editor manually by User Roles with a Filter with code
- How to use add_filter to add the extra data to existing array?
- “Invalid parameter(s): attributes” issue in context of “blocks.registerBlockType” filter
- How to override hook from themes functions.php which is defined in plugin
- Load More : Admin Ajax 400 Bad request, returning 0