以下是我在设置新wordpress博客时始终使用的代码:
自定义管理员页脚文本
// CUSTOMIZE ADMIN FOOTER TEXT
function custom_admin_footer() {
echo \'<a href="http://www.netconstructor.com/">Website Design by NetConstructor, Inc.</a>\';
}
add_filter(\'admin_footer_text\', \'custom_admin_footer\');
从提要头部删除版本信息
// REMOVE VERSION INFO FROM THE HEAD OF FEEDS
function complete_version_removal() { return \'\'; }
add_filter(\'the_generator\', \'complete_version_removal\');
删除公共网站页面标题中的垃圾邮件
// REMOVE JUNK FROM THE HEADER OF PUBLIC WEBSITE PAGES
remove_action(\'wp_head\', \'rsd_link\');
remove_action(\'wp_head\', \'wp_generator\');
remove_action(\'wp_head\', \'feed_links\', 2);
remove_action(\'wp_head\', \'index_rel_link\');
remove_action(\'wp_head\', \'wlwmanifest_link\');
remove_action(\'wp_head\', \'feed_links_extra\', 3);
remove_action(\'wp_head\', \'start_post_rel_link\', 10, 0);
remove_action(\'wp_head\', \'parent_post_rel_link\', 10, 0);
remove_action(\'wp_head\', \'adjacent_posts_rel_link\', 10, 0);
删除除SYSADMIN之外的所有用户的WORDPRESS更新通知
// REMOVE THE WORDPRESS UPDATE NOTIFICATION FOR ALL USERS EXCEPT SYSADMIN
global $user_login;
get_currentuserinfo();
if ($user_login !== "sysadmin") {
add_action( \'init\', create_function( \'$a\', "remove_action( \'init\', \'wp_version_check\' );" ), 2 );
add_filter( \'pre_option_update_core\', create_function( \'$a\', "return null;" ) );
}
自定义管理员徽标:
// CUSTOM ADMIN LOGIN HEADER LOGO
function my_custom_login_logo() {
echo \'<style type="text/css"> h1 a { background-image:url(\'.get_bloginfo(\'template_directory\').\'/images/excitesteps-login-logo.png) !important; } </style>\';
}
add_action(\'login_head\', \'my_custom_login_logo\');
// CUSTOM ADMIN LOGIC HEADER LOGO
add_action(\'admin_head\', \'my_custom_logo\');
function my_custom_logo() {
echo \'<style type="text/css">#header-logo { background-image: url(\'.get_bloginfo(\'template_directory\').\'/images/excitesteps-icon.gif) !important; }</style>\';
}
// CUSTOM ADMIN LOGIN HEADER LINK & ALT TEXT
function change_wp_login_url() {
echo bloginfo(\'url\');
}
function change_wp_login_title() {
echo get_option(\'blogname\');
}
add_filter(\'login_headerurl\', \'change_wp_login_url\');
add_filter(\'login_headertitle\', \'change_wp_login_title\');