3

Restore WordPress to Default Settings

This is useful for those of you that develop themes, and edit things that might mess up other stuff, or just create a lot of entries in the database that you want to clean out.


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');
Levels: Syntax: ,

User Comments

( ADD YOURS )

  1. Hello, pardon my lack of knowledge.. I see that it is some sort of script.. But where do you run it.


  2. Add it to your functions.php file.


  3. Hi, does this delete your comments?

Trackbacks


  1. Avatar

    Your Name
    May 17


    CommentLuv badge