API for easily embedding rich media such as videos and images into content.
package | WordPress |
---|---|
subpackage | Embed |
since | 2.9.0 |
__construct()
maybe_make_link(string $url) : false | string
string
URL to potentially be linked.
false
string
Linked URL or the original URL. False if 'return_false_on_fail' is true.maybe_run_ajax_cache()
register_handler(string $id, string $regex, callable $callback, integer $priority = 10
)
Do not use this function directly, use wp_embed_register_handler() instead.
This function should probably also only be used for sites that do not support oEmbed.
string
An internal ID/name for the handler. Needs to be unique.
string
The regex that will be used to see if this handler should be used for a URL.
callable
The callback function that will be called if the regex is matched.
integer
Optional. Used to specify the order in which the registered handlers will be tested (default: 10). Lower numbers correspond with earlier testing, and handlers with the same priority are tested in the order in which they were added to the action.
run_shortcode(string $content) : string
Since the [embed] shortcode needs to be run earlier than other shortcodes, this function removes all existing shortcodes, registers the [embed] shortcode, calls do_shortcode(), and then re-registers the old shortcodes.
global | array $shortcode_tags |
---|
string
Content to parse
string
Content with shortcode parsedshortcode(array $attr, string $url = ''
) : string | false
Attempts to convert a URL into embed HTML. 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.
array
{ Shortcode attributes. Optional.
@type int $width Width of the embed in pixels.
@type int $height Height of the embed in pixels.
}
string
The URL attempting to be embedded.
string
false
The embed HTML on success, otherwise the original URL.
`->maybe_make_link()` can return false on failure.unregister_handler(string $id, integer $priority = 10
)
Do not use this function directly, use wp_embed_unregister_handler() instead.
string
The handler ID that should be removed.
integer
Optional. The priority of the handler to be removed (default: 10).
$handlers
array()
$last_attr
array()
$last_url
''
$linkifunknown
true
$post_ID
$return_false_on_fail : boolean
false
Bypasses the \'embed_maybe_make_link' filter.
$usecache
true