Add Custom Default Text in WordPress Post Editor

Writing a good content can be difficult, and sometimes confusing to get started , but I knew this can be simplified with a checklist or framework. I wanted to maintain a very  basic and simple blog post framework for myself and something which I can ask my team and guest authors to follow for all future posts. And today I came across a nice article “Anatomy of a good blog post” by Eric Binnion, in his post he shared his framework for writing a good post.

Yes the lightbulb moment, I found it very useful and bookmarked the page, but then I thought I should do something even better.

I had some number contributors and guest authors who might have missed the editorial guidelines. I can’t ask them to refer it every time they write a new post. So I decided to find a way to add guidelines or post framework  text as the default content in WordPress Post Editor, so every time someone click on “add new post”, they see the post framework text by default.
default text wordpress
I found the trick and below is the trick to add your own custom pretext to WordPress Post Editor.

To do this, simply open WordPress theme’s functions.php  file and paste the following code.

// Default post editor text //
function diww_default_post_content( $content ) {
	$content = '<p>Enter your default text in here. This will show up when you add new post.</p>';
	return $content;
add_filter( 'default_content', 'diww_default_post_content' );

Replace the text between $content = ”with your custom text, you could even add XHTML code or link codes if you want. Once you are done, save the file and try creating a new post, you should see the default text there.

Let me know if this tip was helpful and if you know any other way to do the same.

If you enjoyed this one, I'm sure you will love what you see in Archives
More in Web development, WordPress, Wordpress tricks