Skip to content

Instantly share code, notes, and snippets.

@seancojr
Created August 31, 2013 20:14
Show Gist options
  • Save seancojr/6400348 to your computer and use it in GitHub Desktop.
Save seancojr/6400348 to your computer and use it in GitHub Desktop.
Add default post content In WordPress content editor. Source: http://smartwebworker.com/293-default-content-in-wordpress-editor/
<?php
add_filter( 'default_content', 'add_default_content' );
function add_default_content( $content ) {
global $post_type;
switch ( $post_type ) {
case 'post':
$content = "<p>This will be the first paragraph of all new BLOGPOSTS. I am adding a default paragraph. You can add any HTML code or text.</p>";
break;
case 'page':
$content = "<p>This will be the first paragraph of all new PAGES. I am adding a default paragraph. You can add any HTML code or text.</p>";
break;
}
return $content;
}
?>
@bpshbp
Copy link

bpshbp commented Jul 14, 2019

I need default content to be displayed like dis https://web1expert.com/questions/preg_replace-the-e-modifier-is-no-longer-supported-use-preg_replace_callback-instead/ were I't answer will be like dis----we can solve dis question issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment