get post id from wp_insert_post for get_template_part
Declare $my_post_id as global in your code. Declare $my_post_id as global in the-post.php template. Your code: global $my_post_id; $my_post = array( ‘post_type’ => ‘theposttt’, ‘post_title’ => ‘test’, ‘post_content’ => ”, ‘post_status’ => ‘publish’, ‘post_author’ => 1 ); $my_post_id = wp_insert_post($my_post); if(is_wp_error($my_post_id)) $my_post_id = 0; Now, you can use $my_post_id in the-post.php template. Possible values: 0 … Read more