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; ?>
// вместо $db = Db::getConnection();
$db = new PDO('mysql:host=ХОСТ;dbname=ИМЯ БД, ЮЗЕР, ПАРОЛЬ);
// пример 'mysql:host=localhost;dbname=lalka.ru', 'root', '111'
$db->exec("set names utf8");
$result = $db->query('SELECT `post_content` FROM `wp_posts` WHERE `post_content` like \'%https://y%\'');