0

我有一些从 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;
4

1 回答 1

2

具有原始帖子 id 的帖子是当前帖子,您将看到它具有 post_status = 'publish',修订版具有与原始帖子 id 匹配的 post_parent 和 'inherit' 的帖子状态。

我希望这有帮助。/彼得

于 2012-04-23T17:50:26.653 回答