<?php
/**
 * Fonction pour cacher les widgets du dashboard
 *
 * @author	Luc Poupard
 *
 * @link	https://digwp.com/2014/02/disable-default-dashboard-widgets/
 *
 * @package	CDI_Base_Child 2.1.0
 * @since	CDI_Base_Child 2.0.0
 */


/* ----------------------------- */
/* Sommaire */
/* ----------------------------- */
/*
	== Widgets natifs
	== Widgets d'extensions
 */

/**
 * On peut supprimer chaque widget du dashboard indépendamment.
 * Il suffit de commenter ou décommenter la ligne correspondante.
 */
function cdiwp_dashboard_widgets() {
	global $wp_meta_boxes;

	/* == @section Widgets natifs ==================== */
	/* At a Glance */
	unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now'] );

	/* Activity */
	// unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity'] );

	/* Comments */
	unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments'] );

	/* Incoming Links */
	unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links'] );

	/* Plugins */
	unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'] );

	/* Quick Draft */
	unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press'] );

	/* Recent Drafts */
	// unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts'] );

	/* WordPress News */
	unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_primary'] );

	/* */
	unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary'] );


	/* == @section Widgets d'extensions ==================== */
	/* Yoast's SEO Plugin Widget */
	// unset( $wp_meta_boxes['dashboard']['normal']['core']['yoast_db_widget'] );

	/* Gravity Forms Plugin Widget */
	// unset( $wp_meta_boxes['dashboard']['normal']['core']['rg_forms_dashboard'] );

	/* bbPress Plugin Widget */
	// unset( $wp_meta_boxes['dashboard']['normal']['core']['bbp-dashboard-right-now'] );

	/* Postman SMTP */
	unset( $wp_meta_boxes['dashboard']['normal']['core']['example_dashboard_widget'] );

	/* Event Espresso */
	// unset( $wp_meta_boxes['dashboard']['normal']['core']['espresso_news_dashboard_widget'] );
}
add_action( 'wp_dashboard_setup', 'cdiwp_dashboard_widgets', 999 );