When I am creating a post from the admin panel and using a youtube link in the Editor, the editor automatically fetching the video from youtube and displaying right away in the editor.

enter image description here

But When i am using custom code to display the editor in the frontend and putting the youtube URL its not getting the preview of the video.

enter image description here

Is there any specific parameter to pass to the editor for YouTube videos !!

Here is my current code,

$settings = array( 'media_buttons' => false, 'editor_height' => '140px');
$editor_id = 'video_content';
wp_editor( '', $editor_id, $settings );

Any idea how to accomplish this !!

2 Answers 2


Had this same issue, but figured it out once I dug around in WordPress a bit. What you need to do to make this work in a frontend tinyMCE editor is make sure you enqueue this JS file:

add_action( 'wp_enqueue_scripts', function() {
    wp_enqueue_script( 'mce-view' );
} );

Once that is in place your youtube, twitter, etc links will automatically embed in the editor for you to preview.

Hope this saves someone a bunch time! :-)


Perhaps obvious- you've put the URL in the "visual" tab of the editor. Check the "Text" tab and ensure that this isn't wrapping your URL with paragaraph tags and therefore outputting the URL as text. For simplicity, I would turn the "Video Content" meta box into a regular text field.

Hope that helps!

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.