How to preset text in the WordPress post editor

By | May 26, 2009

wordpress_logoIf you’re kind of a lazy person like I am, then here’s just the tutorial for you. Juston Tadlock has perfectly shown how to preset text in the WordPress editor. What does this mean? That you can modify your current WordPress theme’s functions.php file, and with the copying and pasting of a little code, you now have the ability for text to be shown at the bottom of your post, however much you want (with xhtml if you want), without actually putting it in the post editor.

Make note though, this text will show on all of the posts that you make after you modify the theme file, so it will not show up on any of your past posts that you have made.

How do you accomplish this hack? Well, open up your theme’s functions.php file, and copy and paste the following code:

<?php
add_filter( 'default_content', 'my_editor_content' );
function my_editor_content( $content ) {
	$content = "This is some custom content I'm adding to the post editor because I hate re-typing it.";
	return $content;
}
?>

After doing that, you can change the text to whatever you want, and if you want to, can edit it with some xhtml-markup. And that’s it!