3

If I embed something with oEmbed, is there a chance to get the type of the embed (video, audio etc.) ?

If I look at www.oembed.com I see that in the JSON response there is always the data type.

Any chance to get this without hacking the core?

I don't find any functions, except wp_oembed_get, which seems to only return the width and height.

1

I wonder if you mean this:

add_filter( 'oembed_dataparse', function( $return, $data, $url )
{
    // Target only 'video' type:
    if(
            is_object( $data ) 
        &&  property_exists( $data, 'type' )
        &&  'video' === $data->type
    )
    {
        // do stuff
    }
    return $return;
}, 10, 3 );

where we target the video type response from the oEmbed service, before it's cached in the post meta.

  • 1
    Good question, good answer. +1 – kaiser Feb 24 '15 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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