I would like to embed videos & images by entering url in my wordpress site. In WordPress repsitory there are many plugins for embed video by url but in my site I want to enable this functionality from frontend. Registered users can be able to enter a url and this video will enbed in the post. How can I achieve this.

  • Video embeds are now innately supported by Wordpress core. I haven't done much with frontend submission, but do any of the frontend submission plugins now work with this inately as well?
    – Tim Malone
    Commented Jul 6, 2016 at 3:50

2 Answers 2


Wordpress supports quite a few embeds including YouTube since WordPress 2.9.

To render anywhere, just pass your content through the_content filter and it should automatically convert the urls.

$oembedContent = apply_filters( 'the_content', $basicContent );

If the defaults don't meet your needs you can add an oEmbed-Enabled site using wp_oembed_add_provider( $format, $provider, $regex ) or add non oEmbed-Enabled sites using wp_embed_register_handler( $id, $regex, $callback, $priority ). GenerateWP includes a section to generate add_provider code.

To test them out, run your url through wp_oembed_get()

$embed_code = wp_oembed_get( $url, $args ); 

and filter the returned oEmbed HTML with oembed_dataparse. There is a good example of using oembed_dataparse at lorut to make some video embeds responsive.

// Hook onto 'oembed_dataparse' and get 2 parameters
add_filter( 'oembed_dataparse', 'responsive_wrap_oembed_dataparse', 10, 2 );

function responsive_wrap_oembed_dataparse( $html, $data ) {
    // Verify oembed data (as done in the oEmbed data2html code)
    if ( ! is_object( $data ) || empty( $data->type ) ) {
        return $html;

    // Verify that it is a video
    if ( ! ( $data->type == 'video' ) ) {
        return $html;

    // Calculate aspect ratio
    $ar = $data->width / $data->height;

    // Set the aspect ratio modifier
    $ar_mod = ( abs( $ar - ( 4 / 3 ) ) < abs( $ar - ( 16 / 9 ) ) ? 'embed-responsive-4by3' : 'embed-responsive-16by9' );

    // Strip width and height from html
    $html = preg_replace( '/(width|height)="\d*"\s/', "", $html );

    // Return code
    return '<div class="embed-responsive ' . $ar_mod . '" data-aspectratio="' . number_format( $ar, 5, '.' ) . '">' . $html . '</div>';

WordPress 4.4 introduced a oEmbed discovery to allow WP links to be embedded. amaze.website wrote an article on how to style your embeds using embed_head and embed_footer.

// Add custom footer after embed links preview
add_action( 'embed_footer', 'embed_custom_footer_line' );   
function embed_custom_footer_line(){ ?>
    <div id="custom-embed-footer">
        <h3>Our custom Footer line!</h3>
<?php }

I haven't used any of the frontend submission plugins, but there are a decent handful of them around. WPMU recently did an article: http://premium.wpmudev.org/blog/wordpress-post-frontend-plugins/

I've not reviewed the community guidelines recently, but I think requests for plugin suggestions may actually be off-topic here.

  • I tried all these but No one give the functionality of video embed by url so I ask here is there any other way to enable this functionality from frontend
    – poonam
    Commented May 7, 2014 at 11:09
  • No, not directly. You'll need to use a plugin and adjust it to fit your needs.
    – totels
    Commented May 7, 2014 at 13:59

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.