【问题标题】:Wordpress problems retrieving the latest page revision检索最新页面修订的 Wordpress 问题
【发布时间】:2012-05-04 05:46:56
【问题描述】:

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

【问题讨论】:

    标签: php wordpress revision revision-history


    【解决方案1】:

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

    我希望这会有所帮助。 /彼得

    【讨论】:

    • 是的。我的代码可能是错误的,但它没有检索到最新的帖子修订。不过,我现在一切正常。再次感谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-09
    • 1970-01-01
    相关资源
    最近更新 更多