On save_post need to wp_insert_post and save partent post id to child post and child post id to parent post

Here’s an updated version of your code: add_action(‘save_post’, array($this, ‘save_post_type_example_meta_boxes’)); function save_post_type_example_meta_boxes($post_id) ………. if (…) { $new_custom_post = array( ‘post_title’ => $title, ‘post_content’ => ”, ‘post_status’ => ‘publish’, ‘post_author’ => 1, ‘post_type’ => ‘custom_post_type’, ‘meta_input’ => array( ‘meta_1’ => ‘X’, ‘parent_post_id’ => $post_id, ), ); // Prevent this action from running twice. remove_action( ‘save_post’, [ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)