How to insert a YouTube video in post without using a plugin?(Last Updated On: March 11, 2018)
Insert YouTube videos in posts and sidebar without using any extra plugin which means an increase in your site load time. Plugins do increases site load time, it is always advised not to install too many plugins instead install a few which are more important for your blog.
A plugin does the things very easily, so it is preferred plugins over codes.
But this simple code doesn’t require an Einstien brain. A simple code [[youtube]] this all you need to remember.
Now, let’s practically show to you. We are going to embed most popular YouTube video Despacito by Luis Fonsi ft. Daddy Yankee
Open Visual editor and type the following code—[[youtube https://www.youtube.com/watch?v=kJQP7kiw5Fk ]]
If you want to resize its width and height, you need a slight modification to the code—[[youtube https://www.youtube.com/watch?v=kJQP7kiw5Fk&w=420&h=300]]
Where w stands for width and h stands for height.
That’s it simple and easy method with a shortcode.
Note: It may not work with all themes, in most cases all new themes come with this shortcode. Do check it in theme function.php
Now, enjoy the video—[youtube https://www.youtube.com/watch?v=kJQP7kiw5Fk ]