# Creating default text on blog posts in WordPress using PHP

> Insert the same introductory or closing text into every new WordPress post automatically with a small PHP function in your theme.

Source: https://helpcenter.ruachost.com/wordpress/guides/creating-default-text-on-blog-posts-in-wordpress-using-php/

If you often add the same introductory or closing text to your blog posts, you can automate this process by inserting **default text** into the WordPress editor. On **ruachost.com**, this can be achieved by adding a simple PHP function to your theme.

## Why Add Default Text?

- Saves time by avoiding repetitive typing.
- Ensures consistency across all blog posts.
- Useful for adding standard disclaimers, calls to action, or promotional text.

## Steps to Add Default Text

1. **Log in to WordPress** with an administrator account.
2. In the dashboard, go to **Appearance → Theme Editor**.
3. Select your active theme and open the **functions.php** file.
4. Add the following code snippet:

   ```
   // Add default text to new blog posts
   add_filter('default_content', 'ruachost_default_post_content');

   function ruachost_default_post_content($content) {
       $content = "If you enjoyed this post, please share it on social media!";
       return $content;
   }
   ```
5. Save the file.
6. Create a new blog post → The editor will automatically include the default text.

## Important Notes

- This only applies to **new posts** created after adding the code.
- Existing posts will not be affected.
- Always back up your theme before editing `functions.php`.
- Use a **child theme** to preserve changes during updates.
