WP HOOKS
filtrod 2.9.0

embed_oembed_html

Args 4Plik wp-includes/class-wp-embed.phpDokumentacja WP ↗

Opis

Modyfikuje HTML osadzonej treści oEmbed — np. aby owinąć osadzenie w responsywny kontener.

Przykład użycia

add_filter( 'embed_oembed_html', ... )php
add_filter( 'embed_oembed_html', 'wpdocs_wrap_oembed', 10, 4 );

function wpdocs_wrap_oembed( $html, $url, $attr, $post_id ) {
	return '<div class="osadzenie">' . $html . '</div>';
}

Parametry

ParametrTypOpis
$cachestringThe cached HTML result, stored in post meta.
$urlstringThe attempted embed URL.
$attrarrayAn array of shortcode attributes.
$post_idintPost ID.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'embed_oembed_html', 'twoja_funkcja', 10, 4 );

function twoja_funkcja($param_1, $param_2, $param_3, $param_4) {
	// Twój kod
}