Automatically Populating Repeating Content in WordPress


Are you a website owner who makes a point of regularly updating your site with new posts? If so, is there any repetitive content you include in all of the new posts by default? Well, you may be happy to know that there is a way to automatically populate that repetitive content so that you do not have to type it in or cut and paste every time you create a new post. It does require working with code, but it is nothing too complicated. If you can cut and paste repetitive content, you can apply this solution.

Making this work relies on understanding how content is generated within WordPress. The system is built on a series of templates that WordPress uses to determine what individual pages and posts should look like. There are default templates for both pages and posts and, in some cases, other types of content including graphic portfolios. You can generate repetitive content in one fell swoop by adding a short bit of code to your functions.php file.

How to Do It

Below is a step-by-step process explaining how to automatically populate repetitive code on your WordPress site. Although the process is not complicated by any means, it is always wise to create a backup of your site before altering the code. You should be able to generate backups easily through the cPanel or other administrative option provided by your hosting company. Once your backup is complete, follow these steps:

  1. Log onto your site and navigate to the Dashboard.
  2. Using the Administrative menu on the left, go to ‘ Appearance’ → ‘ Editor’. This should bring up a new page that includes an editor for your theme.
  3. Among the list of pages on the right side, scroll until you find functions.php; click on that document to load it into the editor.
  4. Add the following code to the bottom of the document:

add_filter( 'default_content', 'pu_default_editor_content' );

function pu_default_editor_content( $content ) {

global $post_type;

switch( $post_type )


case ‘post’:

$content = ‘Default content for blog posts.’;


case ‘page’:

$content = ‘Default content for pages.’;



return $content;


You will notice the code lets you input default content for blog posts and pages. Modify them as you see fit. For example, if you want all of your posts to include a line that says “We welcome your input using the comment section below”, simply enter the text after ‘$content =. Make sure to leave the apostrophes in place on either side of the content. The last step is to save the file.

Next time you choose to add a new post you should see your default content appear automatically. You can enter your original content above or below.

This simple code makes it very easy to automatically populate repetitive content with little to no effort on your part. Unfortunately, it is too simple to allow for complex formatting of your default content. However, for simple things such as adding lines of text, it works like a charm.

Our Recommended Wordpress Web Hosting Provider


Get a 50% Discount by using our link.

Reliable host, with excellent customer service and an easy one-click Wordpress installation. Our recommendation to host a Wordpress blog.

Leave a Reply

Your email address will not be published. Required fields are marked *