Support » Fixing WordPress » How to track changes to a post (post updates)?

  • Resolved 5280angel


    Can someone help me figure out how to track changes I make to an already-published post? So I want to update an old post, and I want the change to be reflected in my “recent posts” section in the sidebar as if I had just published a new post.

Viewing 4 replies - 1 through 4 (of 4 total)
  • It all depends on what you’re using to display your “recent posts.”

    If it’s a custom SQL query, the sort orderby column it’s using can be changed to post_modified, rather than post_date (which it most likely does).

    If it’s an internal query function like query_posts() or get_posts(), then passing it an orderby parameter value (‘modified’ for the former, ‘post_modified’ for the latter) would do.

    And if it’s a plugin… the above applies, but of course we’re talking about edits to the plugin’s source.

    Thanks for replying. I am using a plugin, and in the widgets.php file I have this section for the recent entries:


    function widget_recent_entries($args) {
    $title = __(‘Recent Posts’, ‘widgets’);
    $r = new WP_Query(‘showposts=5’);
    if ($r->have_posts()) :
    <?php echo $before_widget; ?>
    <?php echo $before_title . $title . $after_title; ?>

    <?php echo $after_widget; ?>

    what can i change in this section to show changes I make to old posts?

    Ah, the solution is an easy one. WP_Query() takes the same parameters as query_posts(), so this line in the plugin:

    $r = new WP_Query('showposts=5');

    can be changed to:

    $r = new WP_Query('showposts=5&orderby=modified');

    That will provide what you’re after.

    Thank you very much! That worked perfectly.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to track changes to a post (post updates)?’ is closed to new replies.