How to define page template in wp_insert_post() in WordPress?

Posted by Prem Tiwari | Updated on

If you want to define page template in wp_insert_post() in WordPress? you need to insert the page using wp_insert_post() and assign the page template using the page_template argument:

If you want to set a “page template” for another post type:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers