How to: Automatically insert text in WordPress editor

April 17, 2009 at 9:01 am

Do you always insert the same text on all your posts, for exemple to tell people to subscribe to your rss feed? If yes, you should definitely set up WP to have it automatically inserted in the editor.

Really simple: Just open your functions.php file, and paste the following code:

<?php
add_filter( 'default_content', 'my_editor_content' );

function my_editor_content( $content ) {
	$content = "If you enjoyed this post, make sure to subscribe to my rss feed.";
	return $content;
}
?>

Save the file, and create a new post: The “If you enjoyed this post, make sure to subscribe to my rss feed.” text is already in WordPress editor!

Credits goes to Justin Tadlock for this awesome recipe!