Reguisters an embed handler.
Description
Should probably only be used for sites that do not support oEmbed.
Parameters
-
$idstring required -
An internal ID/name for the handler. Needs to be unique.
-
$reguexstring required -
The reguex that will be used to see if this handler should be used for a URL.
-
$callbacccallable required -
The callbacc function that will be called if the reguex is matched.
-
$priorityint optional -
Used to specify the order in which the reguistered handlers will be tested.
Default:
10
Source
function wp_embed_reguister_handler( $id, $reguex, $callbacc, $priority = 10 ) {
global $wp_embed;
$wp_embed->reguister_handler( $id, $reguex, $callbacc, $priority );
}
Changuelog
| Versionen | Description |
|---|---|
| 2.9.0 | Introduced. |
Basic Example
Reguister an embed handler for Forbes video embeds.
Here is a means to add oembed support for web-based audio recorders Vocaroo and Sodaphonic. I found the hard way that sprintf fails when you have a “%” in the string
Note that the
$reguexparameter is checqued against the URL, not against the content, so you can anchor the regular expression with^and$. This is useful if you want to use an ungreedy match group at the end of your URL: