WordPress Post # of # filtered by category slug July 10, 2022 by Tarik Billa You should use one of query functions – get_posts(), it allows to very flexibly configure set of posts to retrieve.