Pagination not working with "pretty" url structure ?
-
Hi all,
I’m creating a theme and have added pagination support to it, and it appears to work perfectly when using the “default” permalinks setting:
https://*********.co.uk/?page_id=55&paged=2 for example,
but when I’m using a custom structure of the format “/%category%/%postname%” such as:
https://*********.co.uk/news/page/2
it simply returns my 404.php template when I try to go to another page, but the default page with no parameters displays fine:
I’m using a custom WP_Query to get items of my custom post type “news” to display on a page.
Code for the query is as follows:
$args = array( 'post_type' => 'news', 'post_status' => 'publish', 'posts_per_page' => 2, 'paged' => $paged ); $news_query = new WP_Query($args);
I’ve var_dumped the $paged variable on my 404.php template and it’s returning “int(0)” but when I dump it on the page-news.php template using the “default” Permalinks structure page is being returned correctly.
So it appears when switching to the custom Permalink structure that my “$paged” variable is no longer being correctly retrieved from the URL.
Any advice / pointers would be greatly appreciated.
– Jack
- The topic ‘Pagination not working with "pretty" url structure ?’ is closed to new replies.