我有一些从 Wordpress 后端检索页面的代码。我使用 post_id 来检索它。问题是当我修改页面内容时,更改有一个新的帖子 ID。有没有一种很好的方法来检索页面的最新版本。标题永远不会改变。
我也在 Wordpress 之外访问这些页面。
$pagelisting = $_GET['pagelisting'];
require( '../blog/wp-load.php' );
define('WP_USE_THEMES', false);
query_posts('showposts=1');
$post_id = 195;
$queried_post = get_post($post_id);
$title = $queried_post->post_title;
$content = $queried_post->post_content;
$content = apply_filters('the_content', $content);
echo $content;