0
votes

Okay,

So I have a regular page called Publications and on this page I have a custom WP_Query that queries for a custom post type called article. I list the articles and would like to have pagination on here too, but when I use this code for paginating links, it 404s:

$big = 999999999;

echo paginate_links(array(
    'base' => str_replace($big, '%#%', get_pagenum_link( $big)),
    'format' => '?paged=%#%',
    'current' => max(1, get_query_var('paged')),
    'total' => $wp_query->max_num_pages,
    'prev_text' => __('Previous'),
    'next_text' => __('Next'),
));

Now, my permalinks are set to "Month and name"

When I set my permalinks to the default, it works, but I can't change my permalinks. Anyone else have this problem?

EDIT: I changed the format to '/page/%#%' as well, and it didn't work. Here's my wp_query args as well:

$args = array(
    'posts_per_page'=>10,
    'post_type'=>'article',
    'order'=>'DESC',
    'orderby'=>'post_date',
    'meta_query'=>$meta_query
);

Any help is appreciated

1

1 Answers

0
votes

If you change your permalinks you need to also update your code to match. This part 'format' => '?paged=%#%'

format (string) (optional) Used for Pagination structure. The default value is '?page=%#%', If using pretty permalinks this would be '/page/%#%', where the '%#%' is replaced by the page number. Default: '?page=%#%'

Source