Skip to content

Instantly share code, notes, and snippets.

@damiencarbery
Last active July 17, 2017 07:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save damiencarbery/7a1146cca6d3578de8f04ccec51ced88 to your computer and use it in GitHub Desktop.
Save damiencarbery/7a1146cca6d3578de8f04ccec51ced88 to your computer and use it in GitHub Desktop.
WordPress Multisite: Delete sample content after a new site is created.
<?php
/*
Plugin Name: WordPress MultiSite Delete Sample Content
Plugin URI: http://www.damiencarbery.com/2017/07/multisite-delete-sample-content/
Description: Delete the sample post, page and comment that is created for a new site in a WordPress MultiSite installation. Network Activate this plugin.
Author: Damien Carbery
Version: 0.1
*/
function wpms_delete_sample_content($blog_id, $user_id, $domain, $path, $site_id, $meta) {
switch_to_blog($blog_id);
wp_delete_comment( 1, true );
wp_delete_post(1, true);
wp_delete_post(2, true);
}
add_action( 'wpmu_new_blog', 'wpms_delete_sample_content', 10, 6 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment