Skip to content

Instantly share code, notes, and snippets.

@artikus11
Last active January 12, 2022 12:28
Show Gist options
  • Save artikus11/9303387b5209599b1aa0a129701819d8 to your computer and use it in GitHub Desktop.
Save artikus11/9303387b5209599b1aa0a129701819d8 to your computer and use it in GitHub Desktop.
/**
* Удаляет виджеты из Консоли WordPress.
*
* @return void
*
* @author campusboy
* @verphp 7.0
*/
function remove_widgets_dashboard(): void {
$dash_side = &$GLOBALS['wp_meta_boxes']['dashboard']['side']['core'];
$dash_core = &$GLOBALS['wp_meta_boxes']['dashboard']['normal']['core'];
$dash_high = &$GLOBALS['wp_meta_boxes']['dashboard']['normal']['high'];
// Быстрая публикация
unset( $dash_side['dashboard_quick_press'] );
// Последние черновики
unset( $dash_side['dashboard_recent_drafts'] );
// Новости и мероприятия WordPress
unset( $dash_side['dashboard_primary'] );
// Другие Новости WordPress
unset( $dash_side['dashboard_secondary'] );
// Входящие ссылки
unset( $dash_core['dashboard_incoming_links'] );
// Прямо сейчас
unset( $dash_core['dashboard_right_now'] );
// Последние комментарии
unset( $dash_core['dashboard_recent_comments'] );
unset( $dash_core['dashboard_plugins'] );
// Виджет здоровья
unset( $dash_core['dashboard_site_health'] );
// Активность
unset( $dash_core['dashboard_activity'] );
unset( $dash_core['woo_vl_news_widget'] );
unset( $dash_core['woo_st-dashboard_right_now'] );
unset( $dash_core['woo_st-dashboard_sales'] );
// Виджет OceanWP
unset( $dash_core['owp_dashboard_news'] );
// Виджет WooCommerce
unset( $dash_core['woocommerce_dashboard_status'] );
// Виджет Page Builder от SiteOrigin
unset( $dash_core['so-dashboard-news'] );
// Виджет Rank Math SEO
unset( $dash_high['rank_math_dashboard_widget'] );
}
add_action( 'wp_dashboard_setup', 'remove_widgets_dashboard', 1000 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment