X

Default Post Content

If you want to have some Default Post Content in the BODY content area for all your new posts, copy this code to your theme’s functions.php file.

We can also check the $post_type of that ADD NEW [whatever] page, to set more specific default post content for different post types.

Code Snippet:

<?php
add_filter( 'default_content', 'mytheme_default_body_content' );
function mytheme_default_body_content( $content ) {
	global $post_type;
	switch ( $post_type ) {
		case 'post':
			$content = "&lt;p&gt;I like this to be the first paragraph of each of my blog posts&lt;/p&gt;";
			break;
		case 'page':
			$content = "&lt;p&gt;All my Pages start with this paragraph&lt;/p&gt;";
			break;
	}
	return $content;
}
?>

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!