Make WordPress Core

Opened 14 years ago

Closed 11 years ago

#17027 closed enhancement (duplicate)

Allow WP_Query to return just the count

Reported by: scribu's profile scribu Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Query Keywords: needs-patch
Focuses: Cc:

Description

Currently, you can't ask just for the total number of posts for a certain query.

You have to execute that query and then retrieve the total using SQL_CALC_FOUND_ROWS.

Maybe a 'fields' => 'count' option would do it.

Example where this is needed in Core: #17019

Change History (1)

#1 @wonderboymusic
11 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed

I refreshed the patch of #17019

Note: See TracTickets for help on using tickets.