wp embed
Проверяет поставщиков oEmbed, очищает кэш встраивания и многое другое.
Список команд | Описание |
---|---|
wp embed cache clear | Удаляет все кэш oEmbed у указанной записи. |
wp embed cache find | Находит идентификатор записи кэша oEmbed для данного URL-адреса. |
wp embed cache trigger | Запускает кэширование всех результатов oEmbed для данной записи. |
wp embed fetch | Пытается преобразовать URL-адрес во встроенный HTML. |
wp embed handler list | Список всех доступных обработчиков внедрения. |
wp embed provider list | Список всех доступных поставщиков oEmbed. |
wp embed provider match | Возвращает соответствующего поставщика для данного URL-адреса. |
Примеры
# Clear cache for a post $ wp embed cache clear 123 Success: Cleared oEmbed cache. # Find cache post ID for a given URL. $ wp embed cache find https://www.youtube.com/watch?v=dQw4w9WgXcQ --width=500 123 # Triggers cache for a post $ wp embed cache trigger 456 Success: Caching triggered!
Исходный код команд
wp embed cache clear
Удаляет все кэш oEmbed у указанной записи.
oEmbed caches for a post are stored in the post's metadata.
Использование
wp embed cache clear {post_id}
Можно указать Глобальные параметры и следующие:
- {post_id}
- ID of the post to clear the cache for.
Примеры
# Clear cache for a post $ wp embed cache clear 123 Success: Cleared oEmbed cache.
wp embed cache find
Находит идентификатор записи кэша oEmbed для данного 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.
Not to be confused with oEmbed caches for a given post which are stored in the post's metadata.
Использование
wp embed cache find {url} [--width={width}] [--height={height}] [--discover]
Можно указать Глобальные параметры и следующие:
- {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, so is theme and context dependent.
- [--height={height}]
- Height 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.
- [--discover]
- Whether 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.
Примеры
# 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
Запускает кэширование всех результатов oEmbed для данной записи.
oEmbed caches for a post are stored in the post's metadata.
Использование
wp embed cache trigger {post_id}
Можно указать Глобальные параметры и следующие:
- {post_id}
- ID of the post to do the caching for.
Примеры
# Triggers cache for a post $ wp embed cache trigger 456 Success: Caching triggered!
wp embed fetch
Пытается преобразовать URL-адрес во встроенный HTML.
In non-raw mode, starts by checking the URL against the regex of the registered embed handlers. If none of the regex matches and it's enabled, then the URL will be given to the WP_oEmbed class.
In raw mode, checks the providers directly and returns the data.
Использование
wp embed fetch {url} [--width={width}] [--height={height}] [--post-id={id}] [--discover] [--skip-cache] [--skip-sanitization] [--do-shortcode] [--limit-response-size={size}] [--raw] [--raw-format={json|xml}]
Можно указать Глобальные параметры и следующие:
- {url}
- URL to retrieve oEmbed data for.
- [--width={width}]
- Width of the embed in pixels.
- [--height={height}]
- Height of the embed in pixels.
- [--post-id={id}]
- Cache oEmbed response for a given post.
- [--discover]
- Enable oEmbed discovery. Defaults to true.
- [--skip-cache]
- Ignore already cached oEmbed responses. Has no effect if using the 'raw' option, which doesn't use the cache.
- [--skip-sanitization]
- Remove 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.
- [--do-shortcode]
- If 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.
- [--limit-response-size={size}]
- Limit the size of the resulting HTML when using discovery. Default 150 KB (the standard WordPress limit). Not compatible with 'no-discover'.
- [--raw]
- Return the raw oEmbed response instead of the resulting HTML. Ignores the cache and does not sanitize responses or use registered embed handlers.
- [--raw-format={json|xml}]
Render raw oEmbed data in a particular format. Defaults to json. Can only be specified in conjunction with the 'raw' option.
Может быть:
- json
- xml
Примеры
# Get embed HTML for a given URL. $ wp embed fetch https://www.youtube.com/watch?v=dQw4w9WgXcQ <iframe width="525" height="295" src="https://www.youtube.com/embed/dQw4w9WgXcQ?feature=oembed" ...
# Get raw oEmbed data for a given URL. $ wp embed fetch https://www.youtube.com/watch?v=dQw4w9WgXcQ --raw {"author_url":"https:\/\/www.youtube.com\/user\/RickAstleyVEVO","width":525,"version":"1.0", ...
wp embed handler list
Список всех доступных обработчиков внедрения.
Использование
wp embed handler list [--field={field}] [--fields={fields}] [--format={format}]
Можно указать Глобальные параметры и следующие:
- [--field={field}]
- Display the value of a single field
- [--fields={fields}]
- Limit the output to specific fields.
- [--format={format}]
Render output in a particular format.
По умолчанию: table
Может быть:- table
- csv
- json
Доступные поля
These fields will be displayed by default for each handler:
- id
- regex
These fields are optionally available:
- callback
- priority
Примеры
# List id,regex,priority fields of available handlers. $ wp embed handler list --fields=priority,id +----------+-------------------+ | priority | id | +----------+-------------------+ | 10 | youtube_embed_url | | 9999 | audio | | 9999 | video |
wp embed provider list
Список всех доступных поставщиков oEmbed.
Использование
wp embed provider list [--field={field}] [--fields={fields}] [--format={format}] [--force-regex]
Можно указать Глобальные параметры и следующие:
- [--field={field}]
- Display the value of a single field
- [--fields={fields}]
- Limit the output to specific fields.
- [--format={format}]
Render output in a particular format.
По умолчанию: table
Может быть:- table
- csv
- json
- [--force-regex]
- Turn the asterisk-type provider URLs into regexes.
Доступные поля
These fields will be displayed by default for each provider:
- format
- endpoint
This field is optionally available:
- regex
Примеры
# List format,endpoint fields of available providers. $ wp embed provider list --fields=format,endpoint +------------------------------+-----------------------------------------+ | format | endpoint | +------------------------------+-----------------------------------------+ | #https?://youtu\.be/.*#i | https://www.youtube.com/oembed | | #https?://flic\.kr/.*#i | https://www.flickr.com/services/oembed/ | | #https?://wordpress\.tv/.*#i | https://wordpress.tv/oembed/ |
wp embed provider match
Возвращает соответствующего поставщика для данного URL-адреса.
Использование
wp embed provider match {url} [--discover] [--limit-response-size={size}] [--link-type={json|xml}]
Можно указать Глобальные параметры и следующие:
- {url}
- URL to retrieve provider for.
- [--discover]
- Whether to use oEmbed discovery or not. Defaults to true.
- [--limit-response-size={size}]
- Limit the size of the resulting HTML when using discovery. Default 150 KB (the standard WordPress limit). Not compatible with 'no-discover'.
- [--link-type={json|xml}]
Whether to accept only a certain link type when using discovery. Defaults to any (json or xml), preferring json. Not compatible with 'no-discover'.
Может быть:
- json
- xml
Примеры
# Get the matching provider for the URL. $ wp embed provider match https://www.youtube.com/watch?v=dQw4w9WgXcQ https://www.youtube.com/oembed