Skip to content

Add wp theme cache command - #494

Closed
swissspidy with Copilot wants to merge 13 commits into
mainfrom
copilot/add-wp-theme-cache-command
Closed

swissspidy with Copilot wants to merge 13 commits into
mainfrom
copilot/add-wp-theme-cache-command

Conversation

Copilot AI commented Feb 2, 2026 •

Copy link
Copy Markdown
Contributor
  • Create Theme_Cache_Command.php class with clear and flush methods
  • Register 'theme cache' command in extension-command.php
  • Add Behat tests for theme cache commands
  • Update phpcs.xml.dist to exclude Theme_Cache_Command from prefix rule
  • Update composer.json with new commands
  • Verify code passes linting, code style, and static analysis checks
  • Run code review and security checks
  • Use WP_Theme::cache_delete() method instead of manual cache key construction
  • Implementation complete and ready for review
Original prompt

This section details on the original issue you should resolve

<issue_title>Add wp theme cache command</issue_title>
<issue_description>## Feature Request

Describe your use case and the problem you are facing

Add the following commands

wp theme cache <theme> get <key> 
wp theme cache <theme> add <key> <data>
wp theme cache <theme> delete

Describe the solution you'd like

Add command would map to the method cache_add on WP_Theme class.
Get command would map to the method cache_get on WP_Theme class.
Delete command would map to the method cache_delete on WP_Theme class.

This would help manage and clear theme related caches.

</issue_description>

Comments on the Issue (you are @copilot in this section)

@danielbachhuber I amenable to this. Feel free to submit a pull request, if you'd like. Here is some [guidance on our pull request best practices](https://make.wordpress.org/cli/handbook/contributions/pull-requests/). @swissspidy `WP_Theme::cache_add()` and `WP_Theme::cache_get()` are private, so we can't really use these.

The delete method is public, but maybe this could be used via wp cache delete and wp cache flush-group? The cache key property itself is also private though, so we can't really access it.</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
@github-actions github-actions Bot added command:theme Related to 'theme' command scope:distribution Related to distribution state:unconfirmed labels Feb 2, 2026
Copilot AI changed the title [WIP] Add wp theme cache command functionality Add wp theme cache command Feb 2, 2026
Copilot AI requested a review from swissspidy February 2, 2026 14:05
Comment thread features/theme-cache.feature Resolved
Comment thread features/theme-cache.feature Resolved
Comment thread features/theme-cache.feature Resolved
Comment thread features/theme-cache.feature Resolved
@codecov

This comment was marked as resolved.

@swissspidy
swissspidy marked this pull request as ready for review February 4, 2026 01:56
@swissspidy
swissspidy requested a review from a team as a code owner February 4, 2026 01:56
Copilot AI review requested due to automatic review settings February 4, 2026 01:56

This comment was marked as resolved.

swissspidy and others added 2 commits February 3, 2026 21:09
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread features/theme-cache.feature Resolved
Comment thread features/theme-cache.feature Resolved
Comment thread src/Theme_Cache_Command.php Resolved
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

@swissspidy swissspidy mentioned this pull request Feb 17, 2026
1 task done
@swissspidy
swissspidy marked this pull request as draft February 17, 2026 16:51

Copy link
Copy Markdown
Member

Closing this, as the command wouldn't do much in practice:

  • WordPress keeps the themes cache group non-persistent unless a site opts in via the wp_cache_themes_persistently filter. A fresh WP-CLI process starts with that group empty, so clearing it has no effect on the site.
  • The only lasting effect would be deleting the block pattern transients via WP_Theme::cache_delete(). Those are already invalidated when the theme version changes, and skipped with WP_DEVELOPMENT_MODE=theme.
  • flush is the same as the existing wp cache flush-group themes.
  • The get/add commands requested in Add wp theme cache command #392 can't be built, as WP_Theme::cache_get() and cache_add() are private.

Generated by Claude Code

@swissspidy swissspidy closed this Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:theme Related to 'theme' command scope:distribution Related to distribution state:unconfirmed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add wp theme cache command

3 participants