wordpress自定义优化二

隐藏仪表盘widget

function example_remove_dashboard_widgets(){
    global $wp_meia_boxes;//删除快速发布模块
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
    //删除引入链接模块
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
    //删除插件模块
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
    //删除近期评论模块
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
    //删除近期草稿模块
    unset($wp_meta_boxes['dashboard']['side']['coer']['dashboard_recent_drafts']);
    //删除wordpress开发
    unset($wp_meta_boxes['dashboard']['side']['coer']['dashboard_primary']);
    //删除其他wordpress新闻
    unset($wp_meta_boxes['dashboard']['side']['coer']['dashboard_secondary']);
    //删除概况模块
    unset($wp_meta_boxes['dashboard']['normal']['coer']['dashboard_right_now']);
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);
    //去除活动
    unset($wp_meta_boxes['dashboard']['normal']['high']['dashboard_browser_nag']);
}
add_action('wp_dashboard_setup','example_remove_dashboard_widgets');

add_filter('show_admin_bar','__return_false');
//删除工具栏
remove_action('wp_head','rsd_link');
//删除xmlrpc
remove_action('wp_head','wlwmanifest_link');
//删除wlwmanifest
remove_action('wp_head','wp_generator');
//删除wp版本
remove_action('wp_head','feed_links',2);
//删除文章和评论feed
remove_action('wp_head','feed_links_extra',3);
//删除分类feed
remove_action('wp_head','wp_shortlink_wp_head',10,0);
//删除shortlink
remove_action('wp_head','adjacent_posts_rel_link_wp_head',10,0);
//删除prev next
remove_action('wp_head', 'rel_canonical' ); 
//移除Canonical标记
add_action('wp_before_admin_bar_rendar','dreamlam_admin_bar');
//移除工具条默认菜单
add_action('wp_dashboard_setup','dreamlam_remove_dashboard_widgets');
//删除仪表盘不不要的模版
add_action('wp_dashboard_setup','dreamlam_add_dashboard_widgets');
//仪表盘添加自定义模版
add_action('widgets_init','dreamlam_remove_recent_commnts_style');
//删除最新评论的内联样式
add_action('admin_menu','dreamlam_remove_menus');
//删除不需要的菜单
add_action('admin_init','dreamlam_remove_submenu');
//删除不需要的子菜单
add_action('widgets_init','dreamlam_custom');
//添加自定义动作

移除工具条默认菜单

function wpdaxue_admin_bar(){
     global $wp_admin_bar;
     $wp_admin_bar->remove_menu('wp_logo');
     //移除LOGO
     //$wp_admin_bar->remove_menu('my-account');
     //移除个人中心
     $wp_admin_bar->remove_menu('comments');
     //移除评论
     //$wp_admin_bar->remove_menu('my-sites');
     //移除我的网站(多站点)
     //$wp_admin_bar->remove_menu('site-name');
     //移除网站名称
     //$wp_admin_bar->remove_menu('new-content');
     //移除新建
     //$wp_admin_bar->remove_menu('search');
     //移除搜索
     $wp_admin_bar->remove_menu('updates');
     //移除升级通知
}
add_action('wp_before_admin_bar_render','wpdaxue_admin_bar');

隐藏帮助

add_filter('contextual_help','wpse50723_remove_help',999,3);
function wpse50723_remove_help($old_help,$screen_id,$screen){
     $screen->remove_help_tabs();
     return $old_help;
}

移除前后文、第一篇文章、主页meta信息

remove_action( 'wp_head','index_rel_link' ); // Removes the index link   
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // Removes the prev link   
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 ); // Removes the start link

将Wordpress更正为WordPress

add_filter( 'comment_text', 'capital_P_dangit', 31 );

格式化特殊符号

add_filter( 'comment_text', 'wptexturize' );

转换符号,例如将
变成

add_filter( 'comment_text', 'convert_chars' );

将url自动变成可点击的链接,我们要找的东西

add_filter( 'comment_text', 'make_clickable',  9 );

如其名字所说,将不完整的标签补全

add_filter( 'comment_text', 'force_balance_tags', 25 );

将符号转换为表情

add_filter( 'comment_text', 'convert_smilies', 20 );

自动添加


标签

add_filter( 'comment_text', 'wpautop',  30 );

版权声明:
作者:王金阁
链接:https://www.nnbbxx.net/post-5885.html
来源:王金阁博客
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
< <上一篇
下一篇>>