Add WordPress post type content programatically

To load dummy content programatically load the content below into your functions.php.

This function runs on every page reload so be sure to run it only once and then remove it. Firstly setup the number of posts you need and then also specify the post type. After doing this proceed to your website front end  and reload the page.

After this your dummy posts should be added. Remove that code from your functions..php file and check your admin dashboard.

This is a modified version of Tom McFarlin’s post ( )

Published by Dwain Maralack

Servant, Husband, Software Engineer and all round fun-loving guy, I work as a Developer at WooThemes.

Join the Conversation


  1. Why does it still duplicating my posts even though It is already posted. Seems like the conditional statement get_page_by_title returns true ?

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.