Skip to content

Instantly share code, notes, and snippets.

@peterwegren
Last active December 1, 2016 16:09
Show Gist options
  • Save peterwegren/61c18a4266773cc150c896e1e24252c0 to your computer and use it in GitHub Desktop.
Save peterwegren/61c18a4266773cc150c896e1e24252c0 to your computer and use it in GitHub Desktop.
Clear out some default WP settings on new installation.
<?php
/* modified from https://code.tutsplus.com/tutorials/how-to-activate-plugins-themes-upon-wordpress-installation--cms-23551 */
// set the options to change: https://codex.wordpress.org/Option_Reference
$option = array(
'blogdescription' => '',
'comments_notify' => 0,
'default_comment_status' => 'closed',
'default_ping_status' => 'closed',
'default_pingback_flag' => 0,
'moderation_notify' => 0,
'start_of_week' => 0,
'medium_size_w' => 768,
'medium_size_h' => 768,
'permalink_structure' => '/%postname%/',
'blog_public' => 0,
'gzipcompression' => 1,
'use_smilies' => 0
);
// update the options
foreach ( $option as $key => $value ) {
update_option( $key, $value );
}
// flush rewrite rules
global $wp_rewrite;
$wp_rewrite->flush_rules();
// delete the default content
wp_delete_comment( 1 );
wp_delete_post( 1, TRUE );
wp_delete_post( 2, TRUE );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment