Create a new Page or Post Programmatically in WordPress

| Last Updated: | In: WordPress, WordPress Beginners, WordPress Snippets


If you want to create some demo pages OR Posts during your custom wordpress theme installation, then you can use the wp_insert_post() function inside your functions.php file. Open functions.php file of your theme’s folder and copy paste below code at the end of the file. Below code will create a new page when code will …