wp embed cache
Finds, triggers, and deletes oEmbed caches.
Subcommands
| Command | Description |
|---|---|
| wp embed cache clear | Deletes all oEmbed caches for a given post. |
| wp embed cache find | Finds an oEmbed cache post ID for a given URL. |
| wp embed cache trigger | Triggers the caching of all oEmbed results for a given post. |
wp embed cache clear
Deletes all oEmbed caches for a given post.
oEmbed caches for a post are stored in the post’s metadata.
Synopsis
wp embed cache clear <post_id>
Options
<post_id>
: ID of the post to clear the cache for.
Examples
# Clear cache for a post
$ wp embed cache clear 123
Success: Cleared oEmbed cache.
wp embed cache find
Finds an oEmbed cache post ID for a given URL.
Starting with WordPress 4.9, embeds that aren’t associated with a specific post will be cached in a new oembed_cache post type. There can be more than one such entry for a url depending on attributes and context.
Synopsis
wp embed cache find <url> [--width=<width>] [--height=<height>] [--discover]
Options
<url>
: URL to retrieve oEmbed data for.
[–width=<width>]
: Width of the embed in pixels. Part of cache key so must match. Defaults to content_width if set else 500px.
[–height=<height>]
: Height of the embed in pixels. Part of cache key so must match. Defaults to 1.5 * default width, to a maximum of 1000px.
[–discover]
: Whether to search with the discover attribute set or not.
Examples
# Find cache post ID for a given URL.
$ wp embed cache find https://www.youtube.com/watch?v=dQw4w9WgXcQ --width=500
123
wp embed cache trigger
Triggers the caching of all oEmbed results for a given post.
oEmbed caches for a post are stored in the post’s metadata.
Synopsis
wp embed cache trigger <post_id>
Options
<post_id>
: ID of the post to do the caching for.
Examples
# Triggers cache for a post
$ wp embed cache trigger 456
Success: Caching triggered!