我知道有在BuddyPress的一種方法,它可以幫助隱藏某些個人資料欄位:BuddyPress的隱藏個人資料欄
function bp_has_profile($args = '') {
global $profile_template;
// Only show empty fields if we're on the Dashboard, or we're on a user's profile edit page,
// or this is a registration page
$hide_empty_fields_default = (!is_network_admin() && !is_admin() && !bp_is_user_profile_edit() && !bp_is_register_page());
// We only need to fetch visibility levels when viewing your own profile
if (bp_is_my_profile() || bp_current_user_can('bp_moderate') || bp_is_register_page()) {
$fetch_visibility_level_default = true;
} else {
$fetch_visibility_level_default = false;
}
$defaults = array(
'user_id' => bp_displayed_user_id(),
'profile_group_id' => false,
'hide_empty_groups' => true,
'hide_empty_fields' => $hide_empty_fields_default,
'fetch_fields' => true,
'fetch_field_data' => true,
'fetch_visibility_level' => $fetch_visibility_level_default,
'exclude_groups' => false, // Comma-separated list of profile field group IDs to exclude
'exclude_fields' => false // Comma-separated list of profile field IDs to exclude
);
$r = wp_parse_args($args, $defaults);
extract($r, EXTR_SKIP);
$profile_template = new BP_XProfile_Data_Template($user_id, $profile_group_id, $hide_empty_groups, $fetch_fields, $fetch_field_data, $exclude_groups, $exclude_fields, $hide_empty_fields, $fetch_visibility_level);
return apply_filters('bp_has_profile', $profile_template->has_groups(), $profile_template);
}
我不知道如何調用此方法並傳入「exclude_fields」 => $ IDs_to_hide