Posted By

adambundy on 04/19/11


Tagged

post wordpress types custom


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

adambundy


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


 / Published in: PHP
 

  1. /* -------- put default content into custom post type's main content box -------------- */
  2.  
  3. function my_preset_content() {
  4.  
  5. global $post;
  6.  
  7. if ( $post->post_content == '' and $post->post_type == 'custom_post_type' ) {
  8.  
  9. $default_content = 'my preset content here';
  10.  
  11. } else {
  12. $default_content = $post->post_content;
  13. }
  14. return $default_content;
  15. }
  16.  
  17. add_filter('the_editor_content', 'my_preset_content');

Report this snippet  

You need to login to post a comment.