Automatically Insert Text in a WordPress Post

Posted by Trey Connell on April 22, 2009

Sometimes you want to automatically insert copy into the body of your WordPress post without having to manually paste it in every time. I ran across this handy function from wprecipes.com that does just that:

Edit your theme and paste the following code into your functions.php file:

add_filter( 'default_content', 'my_editor_content' );

function my_editor_content( $content ) {
    $content = "I want this text to be automatically included.";
    return $content;
}
?>

Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

Comments

CommentLuv Enabled