How to set default content for posts in WordPress editor

WordPress comes with a hook called default_content which allows you to set default content in your WordPress post editor on create post page. This can be very helpful if you are repeatedly adding same content in all of your posts for example Asking people to share the post on Facebook or subscribe to RSS feeds.

Use the following code to define your own custom default content,

//Set default content in your WordPress post editor
add_filter( 'default_content', 'ccw_set_default_content', 10, 2 );
function ccw_set_default_content( $content, $post ){
    if ( 'post' !== $post->post_type ){
        return $content;
    }
    return 'This is the default content.';
}

See Also : Allow contributor to upload media – WordPress

0 Comments

Leave a Comment.