Answer the question
In order to leave comments, you need to log in
Why doesn't the Embed link in a Wordpress post load?
I am writing a theme for Wordpress. The posts page is ready, but there is a problem with the embed links.
In the visual post editor, embed links are easily converted into the desired form (for example, a link to a Youtube video becomes a player, a link to an Instagram photo becomes a photo, a link to a Twitter post becomes a Twitter post), i.e. all content is embedded in the Wordpress visual editor normally, the record is saved. But when viewing this post on the single.php page (the standard page template for displaying posts), instead of the built-in embed block, I get a simple, even non-clickable, link (plain text).
What could be the problem?
While in other places such links are converted normally. The only problem is with the records.
PS Emdeb for Instagram added in functions.php file.
Answer the question
In order to leave comments, you need to log in
Well, the answer is starting to emerge...
Here's the code that helped me get the embed links to embed.
<?php
$url = $_SERVER['REQUEST_URI'];
$postid = url_to_postid($url);
$post = get_post($postid);
$title = $post->post_title;
$author = get_the_author_meta("display_name", $post->post_author);
$date = $post->post_date;
$content = apply_filters( 'the_content', $post->post_content ); //ранее было просто $content = $post->post_content;
$com_count = $post->comment_count;
$com_status = $post->comment_status;
$thumbnail = get_the_post_thumbnail_url( $postid, 'full');
?>
<div class="text">
<?php echo $content; ?>
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question