I use oEmbedd functionality of WordPress. All work fine but I need to set custom parameters in the iframe
So I try this without success :
function my_oembed_fetch_url( $provider, $url, $args ) {
// You can find the list of defaults providers in WP_oEmbed::__construct()
if ( strpos( $provider, 'soundcloud' ) !== false) {
if ( isset( $args['show_artwork'] ) ) {
$provider = add_query_arg( 'show_artwork', absint( $args['show_artwork'] ), $provider );
}
}
return $provider;
}
wp_oembed_get('/?url=https%3A//api.soundcloud/tracks/number-exampleXXXXXXX', array('show_artwork' => 'false'));
What's wrong ? Thank you in advance
I use oEmbedd functionality of WordPress. All work fine but I need to set custom parameters in the iframe
So I try this without success :
function my_oembed_fetch_url( $provider, $url, $args ) {
// You can find the list of defaults providers in WP_oEmbed::__construct()
if ( strpos( $provider, 'soundcloud' ) !== false) {
if ( isset( $args['show_artwork'] ) ) {
$provider = add_query_arg( 'show_artwork', absint( $args['show_artwork'] ), $provider );
}
}
return $provider;
}
wp_oembed_get('https://w.soundcloud/player/?url=https%3A//api.soundcloud/tracks/number-exampleXXXXXXX', array('show_artwork' => 'false'));
What's wrong ? Thank you in advance
Share Improve this question asked Jun 14, 2020 at 15:18 JandonJandon 1471 silver badge9 bronze badges1 Answer
Reset to default 1Have you added the filter in your code to utilize "my_oembed_fetch_url" ?
add_filter( 'oembed_fetch_url', 'my_oembed_fetch_url', 10, 3 );
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742350200a4427360.html
评论列表(0条)