public
Last active

T5 Preset editor post content

  • Download Gist
t5-preset-editor-post-content.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
<?php
/**
* Plugin Name: T5 Preset editor post content
* Description: Default text for post content.
* Author: Thomas Scholz
* Author URI: http://toscho.de
* Version: 2012.04.17.2
*/
 
/*
* See wp-admin/includes/post.php function get_default_post_to_edit()
* There are also the filters 'default_title' and 'default_excerpt'
*/
add_filter( 'default_content', 't5_preset_editor_content', 10, 2 );
 
/**
* Fills the default content for post type 'post' if it is not empty.
*
* @param string $content
* @param object $post
* @return string
*/
function t5_preset_editor_content( $content, $post )
{
if ( '' !== $content or 'post' !== $post->post_type )
{
return $content;
}
return 'This is the <em>default</em> content. You may customize it.';
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.