Disable pagination only for specific category

You can try this, replacing my_cat with your category slug. This will modify the main query just before rendering the loop on the archive page of your category.

add_action( 'pre_get_posts', 'wpse_disable_pagination' );
function wpse_disable_pagination( $query ) {

  if( is_category( 'my_cat' ) {
    query->set( 'posts_per_page', '-1' );
  }

}

Leave a Comment