0

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.com' ) !== 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.com/player/?url=https%3A//api.soundcloud.com/tracks/number-exampleXXXXXXX', array('show_artwork' => 'false'));

What's wrong ? Thank you in advance

1 Answer 1

1

Have you added the filter in your code to utilize "my_oembed_fetch_url" ?

add_filter( 'oembed_fetch_url', 'my_oembed_fetch_url', 10, 3 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.