How to remove default column on WPAdmin dashboard shipments’ table?

Removing each columns

add_filter('default_wpcargo_columns', 'remove_default_columns' );
function remove_default_columns( $table_column ){
  //Remove Category column
  unset( $table_column['wpcargo_category'] );
  //Remove Shipment Owner column
  unset( $table_column['registered_shipper'] );
  //Remove Agent column
  unset( $table_column['agent_fields'] );
  //Remove Shipper Name column
  unset( $table_column[wpcargo_shipper_meta_filter()] );
  //Remove Receiver Name column
  unset( $table_column[wpcargo_receiver_meta_filter()] );
  //Remove Date column
  unset( $table_column['wpcargo_date'] );
  //Remove Status column
  unset( $table_column['wpcargo_status'] );
  //Remove Actions column
  unset( $table_column['wpcargo_actions'] );
  return $table_column;
}

Removing Column using User ID

add_filter('default_wpcargo_columns', 'remove_default_columns' );
function remove_default_columns( $table_column ){
   $user_id = 1; // Sample user ID use need to remove the table column
   if( get_current_user_id() === $user_id ){
      //Remove Category column
      unset( $table_column['wpcargo_category'] );
      //Remove Shipment Owner column
      unset( $table_column['registered_shipper'] );
      //Remove Agent column
      unset( $table_column['agent_fields'] );
      //Remove Shipper Name column
      unset( $table_column[wpcargo_shipper_meta_filter()] );
      //Remove Receiver Name column
      unset( $table_column[wpcargo_receiver_meta_filter()] );
      //Remove Date column
      unset( $table_column['wpcargo_date'] );
     //Remove Status column
     unset( $table_column['wpcargo_status'] );
     //Remove Actions column
     unset( $table_column['wpcargo_actions'] );
  }
  return $table_column;
}

Removing Column using User Role

add_filter('default_wpcargo_columns', 'remove_default_columns' );
function remove_default_columns( $table_column ){
  $current_user = wp_get_current_user();
  $user_roles = $current_user->roles;
  // Note: In this sample code, It will restrict the "Client" and "Employee" to view the columns
  $restricted_roles = array( 'wpcargo_client'. 'wpcargo_employee' ); // Sample role to remove the table column
  if( array_intersect( $user_roles, $restricted_roles ) ){
    //Remove Category column
    unset( $table_column['wpcargo_category'] );
    //Remove Shipment Owner column
    unset( $table_column['registered_shipper'] );
    //Remove Agent column
    unset( $table_column['agent_fields'] );
    //Remove Shipper Name column
    unset( $table_column[wpcargo_shipper_meta_filter()] );
    //Remove Receiver Name column
    unset( $table_column[wpcargo_receiver_meta_filter()] );
    //Remove Date column
    unset( $table_column['wpcargo_date'] );
    //Remove Status column
    unset( $table_column['wpcargo_status'] );
    //Remove Actions column
    unset( $table_column['wpcargo_actions'] );
  }
  return $table_column;
}
0
    0
    Your Cart
    Your cart is emptyReturn to Shop