程序员人生 网站导航

WordPress 重置代码:将博客回到默认设置

栏目:WordPress时间:2013-10-20 08:40:00
这段代码将重置你的WordPress回到默认设置。请谨慎使用此代码段,如果需要回到默认设置就把他放置到你的WordPress主题的functions.php,并在重新设置后把他删除掉。

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');
------分隔线----------------------------
------分隔线----------------------------

最新技术推荐