• Resolved aotyehel

    (@aotyehel)


    Is there any way you can update this plugin or add an option to retain the publish dates? When duplicating across sites in a multisite – all the publish dates are set to todays date.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author MagicStick

    (@magicstick)

    Hi aotyehel. Sorry for the late reply. I’ve been up to my eyes in it!

    You can achieve this by adding the following code into your functions.php file:

    PLEASE NOTE: In order for this to work you have to have the default destination post status set to publish. I have added the code in the snippet below to auto set this ‘publish’ behaviour:

    function get_published_date($mpd_process_info){
    
      $mpd_process_info['post_date'] = get_post_field('post_date', $mpd_process_info['source_id']);
     
      return $mpd_process_info;
    }
    
    add_filter('mpd_source_data', 'get_published_date');
    
    function set_published_date($mdp_post, $mpd_process_info){
    
      $mdp_post['post_date'] = $mpd_process_info['post_date'];
      $mdp_post['post_status'] = 'publish';
     
      return $mdp_post;
    
    }
    
    add_filter('mpd_setup_destination_data', 'set_published_date', 10,2);
    Plugin Author MagicStick

    (@magicstick)

    Just so you know I added this ‘Retain Published date’ option to version 0.9.4! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Retain publish date’ is closed to new replies.