Link copied posts to the original


I was wondering wether there's a way for me to link the copied post to the original? Been looking in the files and found that there's a transient being set when copying which I can check in a save_post filter. But this only lets me know wether the post being created is a copy, not from where it's coming!

All I need is to set a meta value on the copies with the original post link or possibly the post id and blog id (even better). Any help here?

Thanks in advance!

  • Vaughan
    • Support/SLS MockingJay

    Hi @tigerton,

    This could certainly be done, but I don't see a hook in the plugin to do this, so it would require you hacking the plugin, this would make updating difficult as it would be overwritten on every update. I will have to ask one of our developers to look at this to see if he can come up with a quick solution for you. Hopefully the developer should respond shortly.


  • tigerton
    • Flash Drive


    This is for anyone looking for an answer to this:
    I found this hook: mcc_copy_posts which is an action fired in inc/content-copier/content-copier-post-type.php
    It takes two parameters, one is an associative array of original post id => new post id and the other is the original blog id.

    Using that we can add our own little code in functions.php which adds some useful meta:

    function do_something($posts, $org_blog){
    		foreach($posts as $key => $value){
    			update_post_meta($value, 'original_post_id', $key);
    			update_post_meta($value, 'is_copy', 1);
    			update_post_meta($value, 'original_blog_id', $org_blog);
    	add_action('mcc_copy_posts', 'do_something', 99, 2);

    Now we can check or query each post if they're a copy and if so get the original post id and blog id to do whatever we want with..

  • Vaughan
    • Support/SLS MockingJay

    Hi @tigerton,

    Sorry, we didn't get back to you, it's been a hectic few weeks here & myself & the actual developer were both on holiday in bulgaria this last week.

    Glad you managed to find a solution and thanks for sharing it, I think this would actually make a good feature as an option in the settings somewhere

    "Include original post URL in copied post content" yes/no

    then at the bottom of each copied post:

    This post was originally posted at by post author

    I have added this to the feature requests for the developer to consider in a future release.

    Hope this helps

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.