I've made a custom meta box for adding an URL to the post, which can be displayed later on the frontend page. This url is inserted in my database correctly. Then I'm getting the url in my code by:
<?php $get_video_url = get_post_meta(get_the_ID(), 'video_url', true); //echo $get_video_url; //When I echo the variable, it's giving me te correct URL back for each post ?>
Now I'm trying to get my iFrame to work. But it gives me this error in console:
Refused to display 'https://www.youtube.com/watch?v=OVoXDk8ps10' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
What I know is that I have
watch?v= inside the URL when it's get out of the database and for an iFrame the URL needs to be with
What my question is, is how I'm able to change the URL after I get it from the database and be able to get the iFrame to work on the frontend?
I'm using this code trying to displaying my iFrame:
<p style="text-align: center;"><iframe src="<?php echo $get_video_url; ?>" frameborder="0" allowfullscreen></iframe></p>