Strip tags from link preview description

This commit is contained in:
grandeljay 2022-06-09 07:05:53 +02:00
parent 935a7e9e76
commit 7f1a54c848

View file

@ -17,7 +17,12 @@ $page = new Page(__FILE__, $post->title->rendered);
if (isset($postMedia->source_url)) { if (isset($postMedia->source_url)) {
$page->link_preview = $postMedia->source_url; $page->link_preview = $postMedia->source_url;
$page->description = $post->excerpt->rendered; }
if (isset($post->excerpt->rendered)) {
$page->description = substr(strip_tags($post->excerpt->rendered), 0, 256);
} else {
$page->description = substr(strip_tags($post->content->rendered), 0, 256);
} }
$page->header(); $page->header();