In a WordPress post, you might have a custom field which is a Youtube link and as this youtube link is just part of the content, you might want to display it directly in the post.
This is called embedded content and in WordPress, it provides a function called wp_oembed_get:
<?php $embed_code = wp_oembed_get( $url, $args ); ?>
To display this youtube video in the post, you can save this field in wp_postmeta table with the meta_key in the table as youtube_link.
The code is as shown below and you could put it at the end of functions.php found in the WordPress theme.