Ok here is working code:
function get_yts() {
$query_args = array(
's' => 'youtube.com/watch?v=',
);
$posts = get_posts( $query_args );
foreach ($posts as $p) {
$input_line = $p->post_content;
$output_array = array();
preg_match('/http(?:s?):\/\/(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]*)(&(amp;)?[\w\?=]*)?/', $input_line, $output_array);
print_r($output_array);
}
}
Related Posts:
- YouTube: How to extract closed caption transcript from YouTube video?
- Is there a way to get all IP addresses of youtube to block it with Windows Firewall?
- YouTube maxresdefault thumbnails
- Youtube – downloading a playlist – youtube-dl
- URL syntax for Youtube video in fullscreen and start at time index
- How to customize an end time for a YouTube video?
- How add class youtube and type/html to oembed code?
- YouTube oEmbed and privacy-enhanced mode
- oEmbed youtube video aspect ratio
- Adding a wrapper to the youtube embed automatically?
- WordPress, oEmbed & YouTube video’s with a ‘dash’
- Link Youtube Channel In WordPress Site
- Embed youtube list with sidemenu opened
- Add latest Youtube videos on main page [closed]
- How do I embed a YouTube video in WordPress 3.0?
- Echo do shortcode with custom field not working
- YouTube API 403 error when website restriction set
- How to change src link in YouTube?
- How to make an image of a YouTube video appear as a thumbnail in the list of blog posts
- WordPress and Youtube problem
- Iframe Youtube video doesn’t work
- display only youtube video sticky post
- Generate a WP post from Youtube Feed
- Importing YouTube Videos As Posts – From Playlists
- YouTube Autoplay not working
- ‘NoneType’ object has no attribute ‘group’
- Youtube api – stop video
- How do I hide related videos at the end of a YouTube playlist embed code?
- Disable play/pause/full screen for HTML5
- How to embed a youtube playlist with a sidebar
- YouTube: How to present embed video with sound muted
- How can I embed a YouTube video in a WordPress template page?
- Use [embed] filter in template files
- How can I clear oEmbed caches for YouTube on posts as they are loaded
- Implementing “Video of the Day” Feature?
- Is it possible to enqueue the Youtube API script or does it have to be inline?
- add_filter to youtube embeds?
- Preventing YouTube embeds loading multiple instances of player JS?
- WordPress Editor not getting youtube video preview
- Youtube – Embed as IFRAME
- Any way to use a custom Parameter for youtube embed without using an iframe?
- Add a YouTube or Vimeo video as a post attachment?
- Youtube parameters within WordPress embed code?
- Cannot embed YouTube video
- Embed YouTube video on category description
- How can i add all videos from youtube playlist as post?
- Use oEmbed in List Items
- vimeo/youtube video embed with thumbnails
- Embed YouTube video from custom field value
- Grab YouTube Thumbnail AFTER Post?
- Embeding YouTube video via a template function throws iframe cross-domain policy error
- Video Embed with Captions in Turkish
- WordPress site in China times out on requests to youtube [closed]
- Remove Title of youtube video
- YouTube embed parameters?
- Embed Youtube video link in wordpress editor
- Iframes inside bootstrap tab disappear when tab is shown
- Cannot embed YouTube videos “Failed to embed” error
- How to set YouTube video as featured image?
- How to save post change url youtube link?
- How can I grab the video id of youtube?
- How to auto embedded youtube with wp_insert_post()
- oEmbed not working in WordPress
- How to change the way wp_embed handles only youtube videos?
- How to embed YouTube videos in posts without adding suggested videos at the end?
- WordPress block editor embeds not working in theme (single.php)
- WordPress keeps autoplaying my Youtube-Links no matter what I write
- How to make my new theme read [youtube id=”id of the video here” width=”600″ height=”350″]?
- How to make an embeded a Youtube video from custom field text responsive to screen size?
- Div around YouTube video
- Use Click Image to Play Youtube Video in a WordPress Loop
- Embedding Youtube video on comments
- Custom youtube shortcode that uses $content
- videos not showing on my tag pages
- iframe with Youtube video appears for logged-in users, but not for incognito users
- Add parameter to first post only
- Get YouTube video id from url in a custom field
- Looking to Customize YouTube Video Embeds
- Limit iframe output in comment-meta commentmetadata
- Adding YouTube button to TinyMCE editor
- add youtube thumbnail in index and single.php add video
- Right align a youtube video
- how to show youtube comment profile pic in wordpress
- How to add srcdoc attribute to YouTube oEmbed in Gutenberg oEmbed Block
- youtube full screen on off permater code help for wordpress
- Youtube iframe embed keeps disappearing from page
- WordPress Mediaelement – Youtube Videos Embed Options
- Post editor doesn’t save embed media [closed]
- Custom YouTube Plugin loading different PHP library on live site and localhost
- Order Posts By Youtube Views
- Widget to embed youtube video
- Add video tag to youtube link fron content
- Youtube Iframe Api play one video at a time
- change output location of plugin function using a custom hook
- Choopy Video Playback in a popup using Artiss Youtube Embed [closed]
- Can someone please help me find a solution to my youtube embed problems? [duplicate]
- Facebook Share button wont recognize embedded video [closed]
- Fetching Video From YouTube Automatically [closed]
- Pull latest Youtube Video from json url and make new post
- Avoid embedding YouTube videos and open them in a new window