Return to Snippet

Revision: 44812
at April 19, 2011 04:51 by adambundy


Initial Code
/* -------- put default content into custom post type's main content box -------------- */

function my_preset_content() {

	global $post;
	
	if ( $post->post_content == '' and $post->post_type == 'custom_post_type' ) {
	
		$default_content = 'my preset content here';
		
	} else {
		$default_content = $post->post_content;
	} 
	return $default_content;
}

add_filter('the_editor_content', 'my_preset_content');

Initial URL

                                

Initial Description

                                

Initial Title
Wordpress pre-populate main content with content, restrict to post type

Initial Tags
post, wordpress

Initial Language
PHP