I use get_post() function to get a specific post content. However, I cannot make the auto embed video runs.
Here is the code
<?php
$post_id = 110;
$queried_post = get_post($post_id);
$content = $queried_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;
?>
I want it auto detect the youtube link and enable the embed video.
The sample content is
Check out this cool video:
That was a cool video.
I haven’t tried this myself, but this is what I can tell you:
get_post()
does the same, although I was not able to verify this in the documentation.Perhaps you can use query_posts() (which doesn’t suppress filters) or
get_posts()
withsuppress_filters=>false
to test this.