Define page template in wp_insert_post
From the wp_insert_post() documentation, the page_template argument reads as follow: page_template: If post_type is ‘page’, will attempt to set the page template. On failure, the function will return either a WP_Error or 0, and stop before the final actions are called. If the post_type is not ‘page’, the parameter is ignored. You can set the … Read more