Introduction

Paginated archives or category templates you create may show page links at the bottom, but the number of pages are wrong for how many posts you have (usually more pages than there are posts.)

This is a conflict between the number of posts you have set in Settings > Reading and the number the archive is set to display. The page numbers are calculated using your setting.

The Solution

You can change this by going to Appearance > Editor and click on archives.php (the plural one). At the top is this:

global $wpquery;
    if (is_paged()) :
        $fetch_archive = query_posts("posts_per_page=12&paged=".get_query_var('paged'));
    else :
        $fetch_archive = query_posts("posts_per_page=12&paged=");
    endif;

Replace it with:

  global $wpquery;
  $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  $args = array('paged' => $paged );
  $fetch_archive = query_posts($args);

 

Elementor