Washing off pastel with water $embedcode = get_post_meta(get_the_ID(),'youtube_url',true); $embedcode = str_replace("http://www.youtube.com/watch?v=","",$embedcode); $embedcode = str_replace("https://www.youtube.com/watch?v=","",$embedcode); $embedcode = str_replace(" ","",$embedcode); ?>