wp-cli / embed-command

Inspects oEmbed providers, clears embed cache, and more.
MIT License
7 stars 11 forks source link

Support --all for `wp embed cache clear` #67

Open stefanfisk opened 2 years ago

stefanfisk commented 2 years ago

Feature Request

- [x] Yes, I reviewed the [contribution guidelines](https://make.wordpress.org/cli/handbook/contributing/). **Describe your use case and the problem you are facing** There's currently no way of completely clearing the oembed cache. This is for example useful after one has added a `oembed_dataparse` filter to modify the HTML. **Describe the solution you'd like** I'd propose adding an `cache clear-all` command. The quick and dirty version is to run `DELETE FROM wp_posts WHERE post_type = 'oembed_cache'` and `DELETE FROM wp_postmeta WHERE meta_key LIKE '_oembed_%'`.
danielbachhuber commented 2 years ago

@stefanfisk The use-case seems reasonable to me!

The feature itself might be better implemented by changing wp embed cache clear <post_id> to wp embed cache clear [<post_id>...] [--all].

With this change, the command should error if neither post IDs nor --all are provided.

Want to submit a pull request with Behat feature tests?