X

Reset blog back to default settings

This snippet will reset wordpress back to the default settings. WARNING please use with care Place this snippet into the functions.php of your wordpress theme and be sure to remove it after settings are reset.


function set_theme_defaults() {
    $o = array(
        'avatar_default'            => 'blank',
        'avatar_rating'             => 'G',
        'category_base'             => '/thema',
        'comment_max_links'         => 0,
        'comments_per_page'         => 0,
        'date_format'               => 'd.m.Y',
        'default_ping_status'       => 'closed',
        'default_post_edit_rows'    => 30,
        'links_updated_date_format' => 'j. F Y, H:i',
        'permalink_structure'       => '/%year%/%postname%/',
        'rss_language'              => 'de',
        'timezone_string'           => 'Etc/GMT-1',
        'use_smilies'               => 0,
    );

    foreach ( $o as $k => $v ){update_option($k, $v);}

    // Delete dummy post and comment.
    wp_delete_post(1, TRUE);
    wp_delete_comment(1);
    return;
}
register_activation_hook(__FILE__, 'set_theme_defaults');

Comments  Leave a Reply

  1. What about making a test installation and letting anyone from the Internet login (like testing out the backend of a theme or of WordPress in general – letting them install plugins and such) and then doing a reset every 12 hours or something – to basic WordPress – only my specified plugins (or no plugins), and no other settings or authors or anything – a full reset?

    1. I guess you could do this however I’m not sure providing access to the admin would be worth while. The idea is more for theme developers so they could test out things and easily reset back to default settings quickly.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!