Support » Plugins » Observations on Duplicate Post Plugin

  • lexhair


    I used this plugin to duplicate a prior post and make edits. When I saved it as a draft, the plugin captured the time of the save as the post date. When I made the final edits a couple of days later and published the post, the post date did not reflect the publish time but rather the time I duplicated the post. If you use the wordpress ‘guid’ field for anything (like I do in a mysql query), that needs to be edited as well to point to the proper permalink. In the Manage Posts screen, the duplicated post (as a draft) showed a post time rather than the conventional WordPress indication of ‘unpublished.’

    If you duplicate a post, quickly edit it and publish it, it’s fine.

Viewing 14 replies - 1 through 14 (of 14 total)
  • MichaelH


    What happens if you edit the Post Timestamp via Manage->Posts->Edit?

    You can edit the Post Timestamp without a problem. I would just prefer if the plugin used the WordPress convention of not inserting a Post Timestamp until the post is published.

    Great plugin! Now if it could work for pages as well…

    lexhair, thanks for your useful observations, I’ll try to fix this as soon as possible!

    I’ve released version 0.3 which fixes this, at least I think (I’m quite new to WordPress API).
    Feel free to tell me if there’s any problem or other suggestions!

    It worked great for duplicating the main parts of the post, but my setup happens to make extensive use of custom fields, and those weren’t duplicated. So I’d love to see those included in a future release. Thanks in advance!

    Hi threefour, sorry for the delay but I wasn’t able to look after my plugin until now…

    It looks that one of the new WordPress features (post revision tracking) breaks “Duplicate post”. This happens because different revisions of the same post are different rows in the wp_posts table on the database; my plugin obviously isn’t aware of that and clones only the last row (i.e. the last revision), and that’s fine for the main fields: but if your custom fields are “spread” on different revisions, only the custom fields added/edited in the last revision (and thus “linked” to the row which is being cloned) will be copied.

    I will try to fix my plugin as soon as possible to make it compatible with the newest version of WP: until then, it seems that disabling post revision tracking (if you don’t need it) can be a quick workaround.
    You have to add the following line in wp-config.php:

    define('WP_POST_REVISIONS', false);

    WARNING: this will work only with posts created from now on, because only those posts will feature the old WP behaviour “1 post – 1 row”.
    If you want to clone an old post that you’ve edited multiple times, this workaround can’t help you, and you will have to wait for the new version of my plugin.

    Hope that I’ve been clear enough (and I haven’t written too many mistakes, since English isn’t my first language).

    UPDATE: Fixing the plugin seemed to be easier than I thought, so I did it without any further delay.
    Version 0.4 is out now, it should be already available for automatic update and it should be compatible up to WordPress 2.6.3

    Feel free to report any problem, suggestion or observation, they’re really welcome. You know, I’m the first user of this plugin: I really care about it because I need it! 🙂

    First of all thank you for this very useful plugin! 🙂

    Does the plugin duplicate custom fields as well?
    Seems like having trouble in doing this. Anybody else having the same problem?

    Found! The problem with custom fields came from values with slashes.

    I solved the problem with passing $meta_info->meta_key through the php function addslashes.

    File /plugins/duplicate-post/duplicate-post.php lines 402 -> 406:


    if ($i<count($post_meta_infos)-1) {
        $sql_query .= "SELECT $new_id, '$meta_info->meta_key', '$meta_info->meta_value' UNION ALL ";
    } else {
        $sql_query .= "SELECT $new_id, '$meta_info->meta_key', '$meta_info->meta_value'";


    $meta_value = addslashes($meta_info->meta_value);
    if ($i<count($post_meta_infos)-1) {
        $sql_query .= "SELECT $new_id, '$meta_info->meta_key', '$meta_value' UNION ALL ";
    } else {
        $sql_query .= "SELECT $new_id, '$meta_info->meta_key', '$meta_value'";

    any info on when this plugin might be ready for WP 2.7?

    :o) thanks!



    Loved the idea of this plug in and it worked pretty much as advertised. The only thing that I noticed wast that it didn’t copy the right permalink structure for me. For example:

    Healthcare Marketing New Year’s Resolutions – Part 1

    When copied turned to:

    Basically the year and month of the permalink were changed. That’s not an easy fix you can make from the edit screen either, so I’ve had to give up on this. Any idea how to fix this? I’m using WP 2.7.




    Thank you for all your observations and suggestions: I’ve put in the fix by teonsight (thank you so much!) and checked my plugin on WP 2.7, it seems to be working, so I’ve released a new version (0.5).
    As usual, feel free to send me all the feedback you want about problems, new features etc.

    @jonmrich: I can see your point, but it seems to me that the wrong permalink is displayed only when you’re editing a new clone of a post. When you publish it, it gets a correct permalink, with the current date. Can you try and tell me if it is right?
    I will still try to find how to fix this.



    Yep. When you save it (you don’t need to even publish) and open it up again, the permalink is correct. It seems to only be wrong when the duplicate first opens. After you save it then go to manage posts and reopen, it’s fine. I’ll assume this means when you publish the same thing happens.


Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Observations on Duplicate Post Plugin’ is closed to new replies.