In less than 20 seconds you can instantly auto embed YouTube Videos in WordPress, you don’t need any plugins, you don’t have to cut/paste any script code you can simply just cut and paste the YouTube share URL into the Text tab in WordPress on it’s own dedicated line and WordPress will convert it to an embed YouTube video.
Here is easy to follow instruction:
Tips on YouTube Embed in WordPress
- Make sure that the YouTube URL is on it’s own line, if shares a line with other text it won’t convert into an embed.
- Make sure you paste the YouTube Share URL in the Text tab, if you paste it on the visual tab it won’t turn into an embedded video because WordPress will wrap link tags around it thinking to turn it into a hyperlink instead by default.
- By default this will make the video the entire width of your post, but sometimes this can be capped at 550px or so, if you find that the auto embed video does not expand to full post with, follow this trick below.
Tip to Make YouTube Embed Video Use Full Post Width
This requires you edit the default WordPress functions.php file, you have to add 1 statement in that file and before you do you must know the exact post width of your blog theme.
You can only edit the WordPress theme functions.php file from the FTP editor or your host provider, the WordPress Admin editor can only edit the theme php file and you should modify your core WordPress functions.php file.
Edit the wp-includes\functions.php file in your WordPress root directory
add this statement anywhere above or below a function statement in the file (not inside a function statement), make sure you change the pixel size to your own theme content post area width.
if ( ! isset( $content_width ) ) $content_width = 830;
Here is an example where I put it in my functions.php file
if ( ! isset( $content_width ) ) $content_width = 830;
function mysql2date( $format, $date, $translate = true ) {
This is an original article from WP Cypher Copyright 2012