如何以编程方式删除WordPress仪表板小部件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何以编程方式删除WordPress仪表板小部件相关的知识,希望对你有一定的参考价值。
function remove_dashboard_widgets() { global $wp_meta_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_right_now']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); } if (!current_user_can('manage_options')) { add_action('wp_dashboard_setup', 'remove_dashboard_widgets' ); }
以上是关于如何以编程方式删除WordPress仪表板小部件的主要内容,如果未能解决你的问题,请参考以下文章
WordPress:以编程方式从 Post Window 隐藏小部件