Hi. How can we help?

Remove from the backend all references to WordPress when a user loged in as a vendor

If you like remove from the backend all references to WordPress when a user logs in as a vendor you can use this code in functions.php of your theme:

if( function_exists('YITH_Vendors') ) {
add_filter('yith_wcmv_to_remove_dashboard_widgets', 'yith_wcmv_to_remove_dashboard_widgets');
if ( ! function_exists('yith_wcmv_to_remove_dashboard_widgets')) {
function yith_wcmv_to_remove_dashboard_widgets($to_removes)
{
$to_removes_custom = array(
array(
'id' => 'fue-dashboard',
'screen' => 'dashboard',
'context' => 'normal'
),
array(
'id' => 'dashboard_primary',
'screen' => 'dashboard',
'context' => 'normal'
),
array(
'id' => 'yith_dashboard_products_news',
'screen' => 'dashboard',
'context' => 'normal'
),
array(
'id' => 'yith_dashboard_blog_news',
'screen' => 'dashboard',
'context' => 'normal'
),
);
return array_merge($to_removes, $to_removes_custom);
}
}

add_action( 'admin_bar_menu', 'yith_wcmv_remove_wp_logo', 5 );
if( ! function_exists( 'yith_wcmv_remove_wp_logo' ) ){
function yith_wcmv_remove_wp_logo(){
$vendor = yith_get_vendor( 'current', 'user' );

if( $vendor->is_valid() ){
remove_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
add_action( 'admin_footer_text', '__return_empty_string', 999 );
add_action( 'update_footer', '__return_empty_string', 999 );
}
}
}

add_action( 'wp_dashboard_setup', 'yith_remove_dashboard_widgets', 11 );
function yith_remove_dashboard_widgets() {
global $wp_meta_boxes;
$vendor = yith_get_vendor( 'current', 'user' );

if( $vendor->is_valid() ){
unset( $wp_meta_boxes['dashboard']['side']['core']['yith_dashboard_products_news'] );
unset( $wp_meta_boxes['dashboard']['side']['core']['yith_dashboard_blog_news'] );
}
}
}
Was this article helpful?
2 out of 3 found this helpful

Back to Help Center >