You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
REST API: Add persistent caching to Comments Count endpoint (#41545)
* Performance: Added caching to WPCOM API get comments endpoint.
The WPCOM_JSON_API::wp_count_comments() did not have any caching
mechanism. This caused noticable loads when many requests to this
endpoint happen in a short period of time on WPCOM. This change adds
a caching method similar to that used in core's get_comments()
function.
* Added changelog for WPCOM JSON API requests for comment counts change.
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- `$where` is built with escaping just above.
1123
+
$count = $wpdb->get_results(
1124
+
"SELECT comment_approved, COUNT(*) AS num_comments
0 commit comments