SELECT `post_content` FROM `wp_posts` WHERE `post_content` like '%https://y%'
$db = Db::getConnection();
$result = $db->query('SELECT `post_content` FROM `wp_posts` WHERE `post_content` like '%https://y%');
$i=0;
while ($row = $result->fetch()) {
$links[i] = $row['post_content'];
$i++;
}
<?php foreach ($links as $link): ?>
<div><a href="<?php echo $link; ?>">ссылка</a></div>
<?php endforeach; ?>