Function: wp_embed_register_handler

wp_embed_register_handler( string $id, string $regex, callable $callback, integer $priority )

Registers an embed handler.

Should probably only be used for sites that do not support oEmbed.

Parameters

Name Type(s) Default Value Description
$id string

An internal ID/name for the handler. Needs to be unique.

$regex string

The regex that will be used to see if this handler should be used for a URL.

$callback callable

The callback function that will be called if the regex is matched.

$priority integer 10

Optional. Used to specify the order in which the registered handlers will be tested. Default 10.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.