Most of the time we need to set the default content to the WordPress article editor, such as the common beginning or article attention items, this article will teach you to the WordPress editor set the default content.
/**
*wordpress Set default content to the story editor
*http://www.endskin.com/default-content-title/
/
function Bing_ Default_content () {return
' default content to set ';
}
Add_filter (' default_content ', ' bing_default_content ');
You can also set the default caption:
/**
*wordpress Set the default title for the story editor
*http://www.endskin.com/default-content-title//
function Bing_ Default_title () {return
' default caption to be set ';
}
Add_filter (' Default_title ', ' bing_default_title ');
After you add the top two pieces of code, open the Publish article interface this is the default:
But what if the site has many custom article types and each article type wants to set the default content separately?
In fact, only need to judge a simple, and then return to each:
/**
*wordpress Custom article types set default content to the editor
*http://www.endskin.com/post-default-content-title/
* *
function Bing_default_content ($content, $post) {
switch ($post->post_type) {case
' post ':
$content = ' The default content of the article ';
break;
Case ' page ':
$content = ' Default content for page ';
break;
Case ' pic ':
$content = ' default content for picture (custom article type) ';
break;
return $content;
}
Add_filter (' default_content ', ' bing_default_content ', 10, 2);
The default title is similar, just want to change default_content hook to Default_title can.