Skip to content

Instantly share code, notes, and snippets.

@thefuxia
Created April 17, 2012 11:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thefuxia/2405345 to your computer and use it in GitHub Desktop.
Save thefuxia/2405345 to your computer and use it in GitHub Desktop.
T5 Preset editor post content
<?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.';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment