删除默认仪表板项目并添加自定义帖子类型的快速草稿小部件

时间:2015-02-19 作者:Shahrukh Khan

我想从wordpress管理面板中删除屏幕选项,删除默认仪表板项目,并在仪表板中为自定义帖子类型“gallery”添加快速草稿小部件。enter image description here

2 个回复
最合适的回答,由SO网友:mikemanger 整理而成

您可以使用“Screen\\u Options\\u show\\u Screen”筛选器删除屏幕选项。

function myplugin_disable_screen_options( $show_screen ) {
    // Logic to allow admins to still access the menu
    if ( current_user_can( \'manage_options\' ) ) {
        return $show_screen;
    }
    return false;
}
add_filter( \'screen_options_show_screen\', \'myplugin_disable_screen_options\' );

SO网友:Shahrukh Khan

要删除所有wordpress默认项,请使用下面给出的代码。

function remove_dashboard_meta() {
        remove_meta_box( \'dashboard_incoming_links\', \'dashboard\', \'normal\' );
        remove_meta_box( \'dashboard_plugins\', \'dashboard\', \'normal\' );
        remove_meta_box( \'dashboard_primary\', \'dashboard\', \'side\' );
        remove_meta_box( \'dashboard_secondary\', \'dashboard\', \'normal\' );
        remove_meta_box( \'dashboard_quick_press\', \'dashboard\', \'side\' );
        remove_meta_box( \'dashboard_recent_drafts\', \'dashboard\', \'side\' );
        remove_meta_box( \'dashboard_recent_comments\', \'dashboard\', \'normal\' );
        remove_meta_box( \'dashboard_right_now\', \'dashboard\', \'normal\' );
        remove_meta_box( \'dashboard_activity\', \'dashboard\', \'normal\');//since 3.8
}
add_action( \'admin_init\', \'remove_dashboard_meta\' );

结束

相关推荐

在安装HC Custom WP-Admin URL后被锁定在管理面板之外

我安装了“HC Custom WP Admin URL”插件(https://wordpress.org/plugins/hc-custom-wp-admin-url/) 然后将admin slug值更改为一个神秘的url(http://example.com/some-cryptic-string) 因此,默认(http://example.com/wp-admin) 不可见。不幸的是,由于某种原因,我现在无法看到任何一个URL。实际上,我现在被排除在CP之外。我可以通过托管提供商的cpanel和php