If you are struggling to get the video id (i.e.v=id
) from YouTube’s URL, use the below function.
function get_youtube_video_id($youtubeUrl) { preg_match_all("#(?<=v=|v\/|vi=|vi\/|youtu.be\/)[a-zA-Z0-9_-]{11}#", $youtubeUrl, $matches); $youtubeVideoID = $matches[0][0]; return $youtubeVideoID; } $youTubeVideoID = get_youtube_video_id('https://www.youtube.com/watch?v=Zftx68K-1D4');
Views: 114
Whats up this is kind of of off topic but I was wanting to know
if blogs use WYSIWYG editors or if you have to manually code with HTML.
I’m starting a blog soon but have no coding skills so I wanted to get advice from someone with experience.
Any help would be greatly appreciated!
You don’t need to add any code for publishing the contents in the blog i.e you don’t need to have any coding skills for running the blog, unless you want to modify the themes styling , or add your own styles/module in the blog
Is there a way to get youtube id without writing a code?
In the YouTube url you can see the combination of numbers and letter after an equal sign(=), which is the ID of YouTube video.
Suppose , https://www.youtube.com/watch?v=ZdP0KM49IVk is YouTube video url. In this url ‘ZdP0KM49IVk’ is the ID of video.
You can directly embed YouTube video in WordPress using an
1. On the YouTube, navigate to the video you want to embed
2.Click on Share -> Embed
3. Copy the code and paste on the editor , where you want video to appear.
You can also adjust the settings of YouTube video.