How to Reset WordPress Default Settings on Your Site

Snippets by IsItWP

Do you want to reset WordPress back to the default settings? This snippet comes in handy for theme developers so they could test out things and easily reset back to default settings.


All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:

WARNING: 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);
register_activation_hook(__FILE__, 'set_theme_defaults');

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: Best WordPress Page Builders (Compared).

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!