How to disable `SQL_CALC_FOUND_ROWS` [duplicate]

First should only disable SQL_CALC_FOUND_ROWS if you aren’t using pagination, to do so set parameter no_found_rows to true in WP_Query.

WP_Query( array( 'no_found_rows' => true ) );

Note get_posts() does that by default.

Leave a Comment