Pagination works locally, but not on live server on custom post type single entry page

Viewed 20

I've got a wordpress custom post type called writer and created a single-writer.php template for it. Displaying all the posts on the single writer page, which have the actual writer assigned to them, added pagination to it. Pagination works fine in local env, but not on the server. I have looked up suggestions, but couldn't find a solution. Slug looks like this for the pagination, which loads the correct posts locally: mydomain/writer/name/page/2 Also on the server when I hover over the page numbers they show the correct url, but when I click on any of them mydomain/writer/name gets loaded (instead of mydomain/writer/name/page/pagenumber). I am using a copy of the prod database. Here is the code:

         
              $args = array(
                'posts_per_page' => 10,
                'post_status' => 'publish',
                'post_type' => 'post',
                'paged' => $paged, //pagination
                'ignore_sticky_posts' => 1, //show only current writer's posts
                'meta_key' => 'articles_author',
                'meta_value' => $id, //writer ID
                'compare' => '=',
              );

                $posts = new WP_Query($args);
               
                if ($posts->have_posts())
                {
                  while ($posts->have_posts()): $posts->the_post(); ?>

                  
                    .....
 
                  <?php    
                   
                  endwhile;
                }
              ?>

              <div class="pagination">
                <?php echo paginate_links(array(
                'current' => $paged,
                'total' => $posts->max_num_pages,
                'end_size' => 2,
                'prev_next' => true,
                'prev_text' => '<span class="previous">previous</span>',
                'next_text' => '<span>next</span>'
              )); ?>
              </div>

              <?php wp_reset_postdata(); ?>
                   
                  endwhile;
                }
              ?>
0 Answers
Related