WordPress pagination on custom script

It is unclear exactly which “built-in pagination methods” you are looking for. WordPress uses several.

If you are looking for the next_posts_links and previous_posts_link functionality, write your own function as those built-in functions depend upon the $wp_query global as you can see in the source. I doubt it is worth the time and effort to try to hack that to work with data from your custom table.

If you want pagination as you see at the bottom of the admin edit post screen, the built-in function paginate_links is generic. So long as you pass in the proper values you can paginate your own data without a problem. I have done it, and it works well, but you have to be very careful with all the parameters. Based on the information in your question, I don’t think I can write the code you need. Plus, I am not even sure if that is what you are looking for.

Leave a Comment