Set the default content in the WordPress article editor. You can set the default content in the WordPress article editor. In most cases, you need to set the default content for the wordpress article editor, for example, you can set the default content in the WordPress article editor by setting a common start.
In many cases, we need to set the default content for the WordPress article editor. for example, we need to put the common start or article precautions. This article will teach you to set the default content for the WordPress editor.
/*** WordPress sets the default content for the article editor * http://www.endskin.com/default-content-title/#/function Bing_default_content () {return 'The default content to be set';} add_filter ('default _ content ', 'bing _ default_content ');
You can also set the default title:
/*** WordPress sets the default title * http://www.endskin.com/default-content-title/#/function Bing_default_title () {return 'Default title' to be set;} add_filter ('default _ title ', 'bing _ default_title ');
After adding the above two pieces of code, open the publishing page, which is like this by default:
However, if a website has many custom document types, what should I do if I want to set the default content for each document type?
In fact, you only need to make a simple judgment and then return the results respectively:
/*** WordPress custom document types: set the default content for the editor * http://www.endskin.com/post-default-content-title/*/function Bing_default_content ($ content, $ post) {switch ($ post-> post_type) {case 'Post ': $ content = 'default document content'; break; case 'page': $ content = 'default page content'; break; case 'Pic ': $ content = 'default content of an image (custom article type) '; break;} return $ content;} add_filter ('default _ content', 'Bing _ default_content ', 10, 2 );
The default title is similar. you only need to replace the default_content hook with default_title.
Articles you may be interested in:
- Tips for customizing the background management interface color scheme in WordPress
- Implement function parsing for sending http requests in WordPress
- PHP functions used to create and retrieve sidebar in WordPress
- How to add and execute actions in WordPress
In most cases, we need to set the default content for the WordPress article editor, for example, to set the common beginning...