Starter Text for New Posts
Fills the editor of every new post with your own starter text or outline, so writers begin from the same structure each time.
Opens WPIDE on
Code
// Post type that gets the starter text.
$wpide_starter_post_type = 'post';
// Starter content (HTML or block markup).
$wpide_starter_content = '<!-- wp:paragraph --><p>Introduction: what will the reader learn?</p><!-- /wp:paragraph -->
<!-- wp:heading --><h2 class="wp-block-heading">Main point</h2><!-- /wp:heading -->
<!-- wp:paragraph --><p>Explain the main idea here.</p><!-- /wp:paragraph -->
<!-- wp:heading --><h2 class="wp-block-heading">Summary</h2><!-- /wp:heading -->';
add_filter( 'default_content', function ( $content, $post ) use ( $wpide_starter_post_type, $wpide_starter_content ) {
if ( '' !== $content || ! $post || $wpide_starter_post_type !== $post->post_type ) {
return $content;
}
return $wpide_starter_content;
}, 10, 2 );
Notes
Change the post type or the starter HTML. Existing posts are not affected.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.