如果有帮助,请尝试以下代码:
function filtered_profile_data( $args ) {
$data = bp_get_member_profile_data( $args );
$defaults = array(
\'field\' => false, // Field name
\'user_id\' => $user_id
);
$r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP );
switch($field) {
case \'Field Name\': // for specific field character limit
$max_len = 10;
break;
default:
$max_len = 5;
break;
}
echo substr( $data, 0, $max_len);
}