Last active
July 17, 2017 07:55
-
-
Save damiencarbery/7a1146cca6d3578de8f04ccec51ced88 to your computer and use it in GitHub Desktop.
WordPress Multisite: Delete sample content after a new site is created.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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