Pagination not working with custom post type
-
I have a custom post type called “custom_news”.
It has this arguement:
'rewrite' => array('with_front' => false,'slug' => 'news'),
So my news post URLs are site.com/news/title-of-postI created a new page called “news” so it’s at site.com/news
The problem is pagination no longer works at site.com/news/page/2
It doesnt work because it’s trying to find an actual news post called “page” but that doesnt exist.How can I make the pagination work while also keeping the news post slug “news”?
$pageNumber = ($paged) ? $paged : 1; $args = array( 'post_type' => 'custom_news', 'posts_per_page' => 10, 'post_status' => 'publish', 'paged' => $pageNumber, ); $query = new WP_Query($args);
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Pagination not working with custom post type’ is closed to new replies.