How to Set Default Text in your Post Editor

This function helps you make repetitive posting much easier

This is a tip that I recently used for a client of mine, who needed to have the process of updating her website as streamlined as possible, because she wasn’t very comfortable with computers or the internet.

She runs a website that provides ForEx trading signals to her members at regular intervals. In order to do this, she maintains a WordPress site that I built, using the Amember software and when she’s ready to send out a trading signal, she creates a new post with the information about the trade and her members are then informed of the new post by email.

The post in WordPress consists of nothing more than details about the trade, which always contains the same preset parameters which she needs to fill in. In order to keep the format of her posts consistent, I wanted to provide her with a default layout, where she could just fill in the blanks and post it without needing to worry about anything.

So after a little research, I came up with a function which I could put in her functionality plugin so that every time she went to create a new post, the default template was loaded up, making life much easier for her. The function uses the default_content filter to add your custom text to the post editor:

This is perfect for guiding clients, or for sites where you’re doing a lot of repetition in your posts. How did you end up using this function?

5 thoughts on “How to Set Default Text in your Post Editor”

  1. Tahir says:

    I was looking for this on a previous project a while and could not find anything so I gave up. But I just completed a new project where I have used this to set up a template for a client for their portfolio page. However a part of me feels like I should have set up a template using meta boxes with pre filled example data but I’m still not 100% comfortable using that option. Thanks for sharing this snippet

    1. I’m glad you found it. I’m actually about to produce another similar site where I would have used this in the past, but I think I’ll be trying the custom meta option instead. I’ll be sure to write about it if I do, so stay tuned.

  2. Nicolas says:

    Hello, I’d love to use these feature i’m just not sure, at all, where am i supposed to paste the code… Could you light me up ? Thanks

    1. You can either put it in your functionality plugin, or if you don’t have one, it should go in your theme’s functions.php file.

  3. tt says:

    If you want to automatically add specific text to your editor while publishing posts or pages, then:

    1) You can install Plugin: Default Post Content


    2) If you want to automatically add specific text to your editor while publishing posts or pages, then insert one of the following codes into functions.php:

    function add_before_content($content) {
    if ( ‘page’ == $post->post_type ) return $content .’Default page content.’;
    if ( ‘post’ == $post->post_type ) return $content .’Default post content.’;
    add_filter(‘the_content’, add_before_content);

Leave a Reply