Can you please check now: hidden link
I've added the following code to your current theme's functions.php file:
function func_add_rfg_entries( $post_id, $post,$update ){
$allowed_post_types = array("galeria-digital");
if ( in_array($post->post_type,$allowed_post_types)) {
remove_action( 'save_post', 'func_add_rfg_entries',999,3 );
if($post->post_status != "auto-draft" and $_GET['post_status']!='all') {
$rfg_ids = toolset_get_related_posts($_GET['post'],'grilla-galeria','parent',999,0,array(),'post_id','child');
if(count($rfg_ids) > 0 ) {
foreach($rfg_ids as $k=>$v):
// Copy post metadata
$data = get_post_custom($v);
$my_post = array(
'post_title' => "rfg-entry-".$post_id,
'post_content' => '',
'post_status' => 'publish',
'post_author' => $post->post_author,
'post_type' => 'grilla-galeria');
// Insert the post into the database
$insert_post_id = wp_insert_post( $my_post );
// connecting RFG item to newly cloned $post_id
toolset_connect_posts('grilla-galeria', $post_id, $insert_post_id );
foreach ( $data as $key => $values) {
foreach ($values as $value) {
add_post_meta( $insert_post_id, $key, $value );
}
}
endforeach;
}
}
add_action( 'save_post', 'func_add_rfg_entries',999,3 );
}
}
add_action( 'save_post', 'func_add_rfg_entries', 999, 3 );
Your post have 28-29 repeating field group items and each repeating field group having more than 10 custom fields.
When I try to duplicate post, I gest "Request Timeout" error, that you will require to manage with your server/hosting support otherwise, if you refresh the page, you will see the post is duplicated and when you edit it I can see the repeating field group entries are also get copied successfully.
Here is the example of post that is duplicated with "Request Timeout" error.
=> hidden link