rwmb_choice_label
This filter allows developers to change the label of choice fields (user
, post
, taxonomy
, and taxonomy_advanced
).
apply_filters( 'rwmb_choice_label', $label, $field, $object );
It has 3 parameters:
Name | Description |
---|---|
$label | The output label |
$field | Field settings |
$object | The post, user, or term object |
This filter has variations:
rwmb_choice_label
: apply to all choice fieldsrwmb_{$field_type}_choice_label
: apply to choice fields with a specific typerwmb_{$field_id}_choice_label
: apply to a field with a specific id
Examples
Display a formatted name instead of the default display name:
add_filter( 'rwmb_some_user_choice_label', function( $label, $field, $object ) {
return "Mr: {$object->first_name}";
}, 10, 3 );