prepare() below supplies every value; the result is cached in a transient just below, not a WP object-cache group. $count = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT post_author) FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type IN ({$placeholders})", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare -- table name is $wpdb->posts, not user input; {$placeholders} is a dynamically-built but fixed-count "%s,%s,..." list phpcs can't statically count, real args supplied via $post_types below. $post_types ) ); set_transient( self::TRANSIENT_KEY, $count, self::TRANSIENT_TTL ); return $count; } }