{"id":28619603,"url":"https://github.com/wp-cli/embed-command","last_synced_at":"2026-03-03T08:11:45.129Z","repository":{"id":45041239,"uuid":"96822749","full_name":"wp-cli/embed-command","owner":"wp-cli","description":"Inspects oEmbed providers, clears embed cache, and more.","archived":false,"fork":false,"pushed_at":"2025-05-20T09:13:27.000Z","size":346,"stargazers_count":8,"open_issues_count":4,"forks_count":11,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-08T23:51:37.832Z","etag":null,"topics":["cli","hacktoberfest","oembed","wordpress","wp-cli","wp-cli-package"],"latest_commit_sha":null,"homepage":null,"language":"Gherkin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wp-cli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-10T21:26:11.000Z","updated_at":"2025-05-12T18:25:21.000Z","dependencies_parsed_at":"2024-04-04T12:45:19.436Z","dependency_job_id":"2b4fe7fd-02a1-41da-ab30-e9d49b5925f6","html_url":"https://github.com/wp-cli/embed-command","commit_stats":{"total_commits":158,"total_committers":13,"mean_commits":"12.153846153846153","dds":0.7721518987341772,"last_synced_commit":"ccf8263ea04538c551c3f0144fc1ffe6dc9d31b6"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/wp-cli/embed-command","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Fembed-command","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Fembed-command/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Fembed-command/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Fembed-command/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wp-cli","download_url":"https://codeload.github.com/wp-cli/embed-command/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Fembed-command/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259400361,"owners_count":22851797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","hacktoberfest","oembed","wordpress","wp-cli","wp-cli-package"],"created_at":"2025-06-12T04:40:35.720Z","updated_at":"2026-03-03T08:11:40.107Z","avatar_url":"https://github.com/wp-cli.png","language":"Gherkin","readme":"wp-cli/embed-command\n====================\n\nInspects oEmbed providers, clears embed cache, and more.\n\n[![Testing](https://github.com/wp-cli/embed-command/actions/workflows/testing.yml/badge.svg)](https://github.com/wp-cli/embed-command/actions/workflows/testing.yml)\n\nQuick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) | [Support](#support)\n\n## Using\n\nThis package implements the following commands:\n\n### wp embed\n\nInspects oEmbed providers, clears embed cache, and more.\n\n~~~\nwp embed\n~~~\n\n**EXAMPLES**\n\n    # Get embed HTML for a given URL.\n    $ wp embed fetch https://www.youtube.com/watch?v=dQw4w9WgXcQ\n    \u003ciframe width=\"525\" height=\"295\" src=\"https://www.youtube.com/embed/dQw4w9WgXcQ?feature=oembed\" ...\n\n    # Find cache post ID for a given URL.\n    $ wp embed cache find https://www.youtube.com/watch?v=dQw4w9WgXcQ --width=500\n    123\n\n    # List format,endpoint fields of available providers.\n    $ wp embed provider list\n    +------------------------------+-----------------------------------------+\n    | format                       | endpoint                                |\n    +------------------------------+-----------------------------------------+\n    | #https?://youtu\\.be/.*#i     | https://www.youtube.com/oembed          |\n    | #https?://flic\\.kr/.*#i      | https://www.flickr.com/services/oembed/ |\n    | #https?://wordpress\\.tv/.*#i | https://wordpress.tv/oembed/            |\n\n    # List id,regex,priority fields of available handlers.\n    $ wp embed handler list --fields=priority,id\n    +----------+-------------------+\n    | priority | id                |\n    +----------+-------------------+\n    | 10       | youtube_embed_url |\n    | 9999     | audio             |\n    | 9999     | video             |\n    +----------+-------------------+\n\n\n\n### wp embed fetch\n\nAttempts to convert a URL into embed HTML.\n\n~~~\nwp embed fetch \u003curl\u003e [--width=\u003cwidth\u003e] [--height=\u003cheight\u003e] [--post-id=\u003cid\u003e] [--discover] [--skip-cache] [--skip-sanitization] [--do-shortcode] [--limit-response-size=\u003csize\u003e] [--raw] [--raw-format=\u003cjson|xml\u003e]\n~~~\n\nIn non-raw mode, starts by checking the URL against the regex of the registered embed handlers.\nIf none of the regex matches and it's enabled, then the URL will be given to the WP_oEmbed class.\n\nIn raw mode, checks the providers directly and returns the data.\n\n**OPTIONS**\n\n\t\u003curl\u003e\n\t\tURL to retrieve oEmbed data for.\n\n\t[--width=\u003cwidth\u003e]\n\t\tWidth of the embed in pixels.\n\n\t[--height=\u003cheight\u003e]\n\t\tHeight of the embed in pixels.\n\n\t[--post-id=\u003cid\u003e]\n\t\tCache oEmbed response for a given post.\n\n\t[--discover]\n\t\tEnable oEmbed discovery. Defaults to true.\n\n\t[--skip-cache]\n\t\tIgnore already cached oEmbed responses. Has no effect if using the 'raw' option, which doesn't use the cache.\n\n\t[--skip-sanitization]\n\t\tRemove the filter that WordPress from 4.4 onwards uses to sanitize oEmbed responses. Has no effect if using the 'raw' option, which by-passes sanitization.\n\n\t[--do-shortcode]\n\t\tIf the URL is handled by a registered embed handler and returns a shortcode, do shortcode and return result. Has no effect if using the 'raw' option, which by-passes handlers.\n\n\t[--limit-response-size=\u003csize\u003e]\n\t\tLimit the size of the resulting HTML when using discovery. Default 150 KB (the standard WordPress limit). Not compatible with 'no-discover'.\n\n\t[--raw]\n\t\tReturn the raw oEmbed response instead of the resulting HTML. Ignores the cache and does not sanitize responses or use registered embed handlers.\n\n\t[--raw-format=\u003cjson|xml\u003e]\n\t\tRender raw oEmbed data in a particular format. Defaults to json. Can only be specified in conjunction with the 'raw' option.\n\t\t---\n\t\toptions:\n\t\t  - json\n\t\t  - xml\n\t\t---\n\n**EXAMPLES**\n\n    # Get embed HTML for a given URL.\n    $ wp embed fetch https://www.youtube.com/watch?v=dQw4w9WgXcQ\n    \u003ciframe width=\"525\" height=\"295\" src=\"https://www.youtube.com/embed/dQw4w9WgXcQ?feature=oembed\" ...\n\n    # Get raw oEmbed data for a given URL.\n    $ wp embed fetch https://www.youtube.com/watch?v=dQw4w9WgXcQ --raw\n    {\"author_url\":\"https:\\/\\/www.youtube.com\\/user\\/RickAstleyVEVO\",\"width\":525,\"version\":\"1.0\", ...\n\n\n\n### wp embed provider\n\nRetrieves oEmbed providers.\n\n~~~\nwp embed provider\n~~~\n\n**EXAMPLES**\n\n    # List format,endpoint fields of available providers.\n    $ wp embed provider list\n    +------------------------------+-----------------------------------------+\n    | format                       | endpoint                                |\n    +------------------------------+-----------------------------------------+\n    | #https?://youtu\\.be/.*#i     | https://www.youtube.com/oembed          |\n    | #https?://flic\\.kr/.*#i      | https://www.flickr.com/services/oembed/ |\n    | #https?://wordpress\\.tv/.*#i | https://wordpress.tv/oembed/            |\n\n    # Get the matching provider for the URL.\n    $ wp embed provider match https://www.youtube.com/watch?v=dQw4w9WgXcQ\n    https://www.youtube.com/oembed\n\n\n\n### wp embed provider list\n\nLists all available oEmbed providers.\n\n~~~\nwp embed provider list [--field=\u003cfield\u003e] [--fields=\u003cfields\u003e] [--format=\u003cformat\u003e] [--force-regex]\n~~~\n\n**OPTIONS**\n\n\t[--field=\u003cfield\u003e]\n\t\tDisplay the value of a single field\n\n\t[--fields=\u003cfields\u003e]\n\t\tLimit the output to specific fields.\n\n\t[--format=\u003cformat\u003e]\n\t\tRender output in a particular format.\n\t\t---\n\t\tdefault: table\n\t\toptions:\n\t\t  - table\n\t\t  - csv\n\t\t  - json\n\t\t---\n\n\t[--force-regex]\n\t\tTurn the asterisk-type provider URLs into regexes.\n\n**AVAILABLE FIELDS**\n\nThese fields will be displayed by default for each provider:\n\n* format\n* endpoint\n\nThis field is optionally available:\n\n* regex\n\n**EXAMPLES**\n\n    # List format,endpoint fields of available providers.\n    $ wp embed provider list --fields=format,endpoint\n    +------------------------------+-----------------------------------------+\n    | format                       | endpoint                                |\n    +------------------------------+-----------------------------------------+\n    | #https?://youtu\\.be/.*#i     | https://www.youtube.com/oembed          |\n    | #https?://flic\\.kr/.*#i      | https://www.flickr.com/services/oembed/ |\n    | #https?://wordpress\\.tv/.*#i | https://wordpress.tv/oembed/            |\n\n\n\n### wp embed provider match\n\nGets the matching provider for a given URL.\n\n~~~\nwp embed provider match \u003curl\u003e [--discover] [--limit-response-size=\u003csize\u003e] [--link-type=\u003cjson|xml\u003e]\n~~~\n\n**OPTIONS**\n\n\t\u003curl\u003e\n\t\tURL to retrieve provider for.\n\n\t[--discover]\n\t\tWhether to use oEmbed discovery or not. Defaults to true.\n\n\t[--limit-response-size=\u003csize\u003e]\n\t\tLimit the size of the resulting HTML when using discovery. Default 150 KB (the standard WordPress limit). Not compatible with 'no-discover'.\n\n\t[--link-type=\u003cjson|xml\u003e]\n\t\tWhether to accept only a certain link type when using discovery. Defaults to any (json or xml), preferring json. Not compatible with 'no-discover'.\n\t\t---\n\t\toptions:\n\t\t  - json\n\t\t  - xml\n\t\t---\n\n**EXAMPLES**\n\n    # Get the matching provider for the URL.\n    $ wp embed provider match https://www.youtube.com/watch?v=dQw4w9WgXcQ\n    https://www.youtube.com/oembed\n\n\n\n### wp embed handler\n\nRetrieves embed handlers.\n\n~~~\nwp embed handler\n~~~\n\n**EXAMPLES**\n\n    # List id,regex,priority fields of available handlers.\n    $ wp embed handler list --fields=priority,id\n    +----------+-------------------+\n    | priority | id                |\n    +----------+-------------------+\n    | 10       | youtube_embed_url |\n    | 9999     | audio             |\n    | 9999     | video             |\n\n\n\n### wp embed handler list\n\nLists all available embed handlers.\n\n~~~\nwp embed handler list [--field=\u003cfield\u003e] [--fields=\u003cfields\u003e] [--format=\u003cformat\u003e]\n~~~\n\n**OPTIONS**\n\n\t[--field=\u003cfield\u003e]\n\t\tDisplay the value of a single field\n\n\t[--fields=\u003cfields\u003e]\n\t\tLimit the output to specific fields.\n\n\t[--format=\u003cformat\u003e]\n\t\tRender output in a particular format.\n\t\t---\n\t\tdefault: table\n\t\toptions:\n\t\t  - table\n\t\t  - csv\n\t\t  - json\n\t\t---\n\n**AVAILABLE FIELDS**\n\nThese fields will be displayed by default for each handler:\n\n* id\n* regex\n\nThese fields are optionally available:\n\n* callback\n* priority\n\n**EXAMPLES**\n\n    # List id,regex,priority fields of available handlers.\n    $ wp embed handler list --fields=priority,id\n    +----------+-------------------+\n    | priority | id                |\n    +----------+-------------------+\n    | 10       | youtube_embed_url |\n    | 9999     | audio             |\n    | 9999     | video             |\n\n\n\n### wp embed cache\n\nFinds, triggers, and deletes oEmbed caches.\n\n~~~\nwp embed cache\n~~~\n\n**EXAMPLES**\n\n    # Find cache post ID for a given URL.\n    $ wp embed cache find https://www.youtube.com/watch?v=dQw4w9WgXcQ --width=500\n    123\n\n    # Clear cache for a post.\n    $ wp embed cache clear 123\n    Success: Cleared oEmbed cache.\n\n    # Triggers cache for a post.\n    $ wp embed cache trigger 456\n    Success: Caching triggered!\n\n\n\n### wp embed cache clear\n\nDeletes all oEmbed caches for a given post.\n\n~~~\nwp embed cache clear \u003cpost_id\u003e\n~~~\n\noEmbed caches for a post are stored in the post's metadata.\n\n**OPTIONS**\n\n\t\u003cpost_id\u003e\n\t\tID of the post to clear the cache for.\n\n**EXAMPLES**\n\n    # Clear cache for a post\n    $ wp embed cache clear 123\n    Success: Cleared oEmbed cache.\n\n\n\n### wp embed cache find\n\nFinds an oEmbed cache post ID for a given URL.\n\n~~~\nwp embed cache find \u003curl\u003e [--width=\u003cwidth\u003e] [--height=\u003cheight\u003e] [--discover]\n~~~\n\nStarting with WordPress 4.9, embeds that aren't associated with a specific post will be cached in\na new oembed_cache post type. There can be more than one such entry for a url depending on attributes and context.\n\nNot to be confused with oEmbed caches for a given post which are stored in the post's metadata.\n\n**OPTIONS**\n\n\t\u003curl\u003e\n\t\tURL to retrieve oEmbed data for.\n\n\t[--width=\u003cwidth\u003e]\n\t\tWidth of the embed in pixels. Part of cache key so must match. Defaults to `content_width` if set else 500px, so is theme and context dependent.\n\n\t[--height=\u003cheight\u003e]\n\t\tHeight of the embed in pixels. Part of cache key so must match. Defaults to 1.5 * default width (`content_width` or 500px), to a maximum of 1000px.\n\n\t[--discover]\n\t\tWhether to search with the discover attribute set or not. Part of cache key so must match. If not given, will search with attribute: unset, '1', '0', returning first.\n\n**EXAMPLES**\n\n    # Find cache post ID for a given URL.\n    $ wp embed cache find https://www.youtube.com/watch?v=dQw4w9WgXcQ --width=500\n    123\n\n\n\n### wp embed cache trigger\n\nTriggers the caching of all oEmbed results for a given post.\n\n~~~\nwp embed cache trigger \u003cpost_id\u003e\n~~~\n\noEmbed caches for a post are stored in the post's metadata.\n\n**OPTIONS**\n\n\t\u003cpost_id\u003e\n\t\tID of the post to do the caching for.\n\n**EXAMPLES**\n\n    # Triggers cache for a post\n    $ wp embed cache trigger 456\n    Success: Caching triggered!\n\n## Installing\n\nThis package is included with WP-CLI itself, no additional installation necessary.\n\nTo install the latest version of this package over what's included in WP-CLI, run:\n\n    wp package install git@github.com:wp-cli/embed-command.git\n\n## Contributing\n\nWe appreciate you taking the initiative to contribute to this project.\n\nContributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.\n\nFor a more thorough introduction, [check out WP-CLI's guide to contributing](https://make.wordpress.org/cli/handbook/contributing/). This package follows those policy and guidelines.\n\n### Reporting a bug\n\nThink you’ve found a bug? We’d love for you to help us get it fixed.\n\nBefore you create a new issue, you should [search existing issues](https://github.com/wp-cli/embed-command/issues?q=label%3Abug%20) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.\n\nOnce you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/wp-cli/embed-command/issues/new). Include as much detail as you can, and clear steps to reproduce if possible. For more guidance, [review our bug report documentation](https://make.wordpress.org/cli/handbook/bug-reports/).\n\n### Creating a pull request\n\nWant to contribute a new feature? Please first [open a new issue](https://github.com/wp-cli/embed-command/issues/new) to discuss whether the feature is a good fit for the project.\n\nOnce you've decided to commit the time to seeing your pull request through, [please follow our guidelines for creating a pull request](https://make.wordpress.org/cli/handbook/pull-requests/) to make sure it's a pleasant experience. See \"[Setting up](https://make.wordpress.org/cli/handbook/pull-requests/#setting-up)\" for details specific to working on this package locally.\n\n## Support\n\nGitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support\n\n\n*This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.*\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-cli%2Fembed-command","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwp-cli%2Fembed-command","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-cli%2Fembed-command/lists"}