Skip to main content
6 events
when toggle format what by license comment
Oct 4, 2023 at 11:31 answer added buzz timeline score: 0
Oct 4, 2023 at 11:08 comment added buzz @TomJNowell so what solution will you be advising here? I'm totally lost on how to solve this
Oct 4, 2023 at 9:49 comment added Tom J Nowell the core problem is that those pagination functions are for the main query, but you've discarded the main query and created a brand new custom bespoke second query that does its own thing using new WP_Query, and the pagination functions are totally unaware of this. In addition, your new query has no concept of pagination, it's been told to use 15 posts per page, but at no point is it ever told which page it's on, the paged parameter is completely missing. Unfortunately the secondary query method doubles the cost of the page.
Oct 4, 2023 at 5:55 comment added buzz so this is on the blog page that was created in the custom theme template. I even tried the built in solution for pagination which is the_posts_pagination(). It didn't work @TomJNowell
Oct 3, 2023 at 13:54 comment added Tom J Nowell is this on a page template or on your homepage? At no point is the query argument setting the current page so it will always default to the first, but if this is a homepage or blog archive then there's no reason to use WP_Query, pre_get_posts would be much faster and efficient, it's even possible this could be done entirely by appending ?category_name=xyz to the URL instead of using ?posts=, which is something WP already supports out of the box
Oct 3, 2023 at 12:42 history asked buzz CC BY-SA 4.0