wp-query-cache

Audit and refactor WordPress query-cache writes to use salted cache helpers.

21|1|Updated Apr 29, 2026
One-click install
npx skills add https://github.com/Lonsdale201/wp-agent-skills --skill wp-query-cache
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wp-query-cache
Source: https://github.com/Lonsdale201/wp-agent-skills/tree/main/wordpress/wp-query-cache
Command: npx skills add https://github.com/Lonsdale201/wp-agent-skills --skill wp-query-cache

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Review and implement WordPress query-cache usage for WP 6.9+ with salted cache helpers. This guide explains how to replace direct interactions with query-cache groups by using salted helpers like wp_cache_get_salted, wp_cache_set_salted, and related last_changed salts, to ensure correctness and reduce stale keys. It also helps plugin authors understand when to prefer native WordPress query APIs over manual cache writes.

Core Features & Use Cases

  • Understand salted cache helpers and when to apply them in post-queries, term-queries, user-queries, and other groups.
  • Identify scenarios where direct object-cache writes lead to stale data and how to remediate with core APIs.
  • Use cases include optimizing expensive reads, persistent object cache behavior, and bug-safe cache invalidation.

Quick Start

Audit and refactor direct query-cache writes in your plugin code to use salted cache helpers and core query APIs where appropriate.

Frequently Asked Questions about wp-query-cache

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent stale data in WordPress query cache?

Prevent stale data in WordPress query cache by replacing direct object-cache writes with salted helpers like wp_cache_get_salted and wp_cache_set_salted, which use last_changed salts across query groups to maintain cache correctness and invalidate outdated keys.

What are salted cache helpers in WordPress and when should I use them?

Salted cache helpers in WordPress are functions like wp_cache_get_salted and wp_cache_set_salted that use last_changed salts for cache invalidation. Use them for post-queries, term-queries, and user-queries to safely optimize expensive reads and ensure bug-safe cache invalidation with persistent object cache.

How do I refactor direct object-cache writes in my WordPress plugin?

Refactor direct object-cache writes in WordPress plugins by auditing plugin code and replacing manual cache writes with salted cache helpers and native WP_Query APIs, ensuring proper cache invalidation across query groups and preventing stale reads.

Should I use core WP_Query APIs or manual cache writes for WordPress queries?

Use core WP_Query APIs instead of manual cache writes for WordPress queries because manual object-cache writes lead to stale data, whereas native APIs handle invalidation internally via last_changed salts, ensuring correctness across post-queries and term-queries.

Does WordPress 6.9 support salted cache helpers for query groups?

WordPress 6.9+ supports salted cache helpers like wp_cache_get_salted and wp_cache_set_salted for query groups including post-queries, term-queries, and user-queries, applying last_changed salts to maintain cache correctness and reduce stale keys in persistent object cache scenarios.

Why are my WordPress term-queries returning stale cached results?

WordPress term-queries return stale cached results when plugins bypass salted cache helpers and use direct object-cache writes, because without last_changed salts applied to query groups, cache invalidation fails and outdated keys persist in the persistent object cache.