我是 PHP/Wordpress 的新手。我试图从 WP DB 调用 post_content,经过几次尝试,我终于能够让它工作,但是这些段落已经消失了。这就是我正在使用的;
$result = mysql_query("SELECT * FROM wp_posts WHERE id=$id");
while($row = mysql_fetch_array($result))
{
echo $row['post_content'];
}
然后我将其更改为;
$result = mysql_query("SELECT * FROM wp_posts WHERE id=$id");
while($row = mysql_fetch_array($result))
{
echo apply_filters('the_content', $post->post_content);
}
我现在可以像在 WP 上看到的那样看到它,但是 post_content 与 $id 不匹配,标题与数据一样好,但内容始终与其他帖子相呼应。
如果解释令人困惑,我深表歉意。谢谢你的帮助。