Stop WP from creating “Sample Page” and “Hello World!” post

Is it possible to stop WP from creating the “Sample Page” and “Hello World!” post when creating a new blog?

Related posts

Leave a Reply

2 comments

  1. If you’re using Multisite

    The accepted answer is destructive in that it cancels all other set-up items in the overridden function. A less destructive way to do it for multisite installs is to delete the default content during new blog creation by hooking in to wpmu_new_blog

    add_action( 'wpmu_new_blog', 'delete_wordpress_defaults', 100, 1 );
    
    function delete_wordpress_defaults(){
    
        // 'Hello World!' post
        wp_delete_post( 1, true );
    
        // 'Sample page' page
        wp_delete_post( 2, true );
    }