get video from content
Assuming your content is in the variable $content you would begin by removing all html tags using wp_strip_all_tags: $new_content = wp_strip_all_tags( $content ); Then you will want to trim that to 200 characters using substr: $new_content = substr( $new_content, 0, 200 ); To retrieve the YouTube video, you’ll need to use preg_match: preg_match( ‘/(<iframe.*?src=”https://wordpress.stackexchange.com/questions/154352/(.*?youtube.*?)”.*?<\/iframe>)/’, $html, … Read more