Description
Line 84 makes a direct $wpdb call without using the WordPress object cache. The Plugin Checker flags this because repeated calls to the same query waste database resources.
Action needed
Wrap the query result with wp_cache_get() / wp_cache_set(), or add an inline PHPCS ignore comment with a justification if caching doesn't make sense for this operation (database optimization results change every time, so caching may be inappropriate here).
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Optimization results are not cacheable.
PHPCS rules
WordPress.DB.DirectDatabaseQuery.DirectQuery (WARNING)
WordPress.DB.DirectDatabaseQuery.NoCaching (WARNING)
Description
Line 84 makes a direct
$wpdbcall without using the WordPress object cache. The Plugin Checker flags this because repeated calls to the same query waste database resources.Action needed
Wrap the query result with
wp_cache_get()/wp_cache_set(), or add an inline PHPCS ignore comment with a justification if caching doesn't make sense for this operation (database optimization results change every time, so caching may be inappropriate here).// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Optimization results are not cacheable.PHPCS rules
WordPress.DB.DirectDatabaseQuery.DirectQuery(WARNING)WordPress.DB.DirectDatabaseQuery.NoCaching(WARNING)