[Solved] Pagination not working for category posts

Do not run custom queries in place of the main query on the home page and any type of archive page. This will always cause an issue. If you need to alter the main query, use pre_get_posts to do so.

To solve this issue, you need remove your code from your category page and go back to the default loop. You should only have the following in your category page

if ( have_posts() ) {
    while ( have_posts() ) {

This will led that you will see all category posts on the category post ordered by post date. As I said, you now need to use pre_get_posts to alter the main query on category pages to set your custom ordering and pagination

You need to add the following in functions.php

add_action( 'pre_get_posts', function ( $q )
    if (    !is_admin() // Only target the front end queries
         && $q->is_main_query() // Targets the main query only
         && $q->is_category() // Only target category pages
    ) {
        $q->set( 'posts_per_page', 10 );
        $q->set( 'meta_key', 'custom_key' );
        $q->set( 'meta_value', '' );
        $q->set( 'meta_compare', '!=' );
        $q->set( 'orderby', 'meta_value_num' );
        $q->set( 'ignore_sticky_posts', 1 );

You should no see 10 posts per page ordered by meta_value_num from the custom field custom_key sorted highest to lowest on your category pages


solved Pagination not working for category posts