Hello @metaphorcreations,
thanks for the quick reply.
I reverted to using this filter:
/************* Fix Duplicate Post Polylang *****************/
if ( is_plugin_active('post-duplicator/m4c-postduplicator.php') ) {
add_action('mtphr_post_duplicator_created', function ($original_id, $duplicate_id, $settings) {
global $wpdb;
// Get term_taxonomy_id of the original-post's translations
$term_taxonomy_id = $wpdb->get_var($wpdb->prepare("
SELECT tr.term_taxonomy_id
FROM {$wpdb->prefix}term_relationships AS tr
JOIN {$wpdb->prefix}term_taxonomy AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
WHERE tr.object_id=%s AND tt.taxonomy = \"post_translations\"
", $duplicate_id)) ?? false;
// Delete wp_term_relationships for duplicated post
if($term_taxonomy_id) {
$wpdb->delete("{$wpdb->prefix}term_relationships", [
'object_id' => $duplicate_id,
'term_taxonomy_id' => $term_taxonomy_id
]);
}
}, 10, 3);
}
But it would be very nice to have an option for this, within the plugin itself.
Best regards,
Julian