Im using the get_users function to show a custom list of users on the site. The only issue Im having a problem figuring out now is how to paginate the result.
This is a sample of the function that Im using:
There doesn’t seem to be an obvious way of creating a pagination for the this function. I would appreciate some help with this.
First get the total number of users:
and the current page:
Set a variable that will decide how many users to display per page:
Then, in your $args array add the offset if the current page != 0, and the max number of users to return:
Now add your code from above, and create the page links:
See
paginate_links()
for a full list of arguments….