Skip to main content

rwmb_the_value

This filter is used to change the returned value of the rwmb_the_value() helper function.

apply_filters( 'rwmb_the_value', $value, $field_id, $args, $object_id );

It accepts 4 parameters:

NameDescription
$valueThe value returned by the rwmb_the_value function
$field_idThe field ID
$argsArguments passed to the rwmb_the_value function
$object_idObject ID

Examples

Format the value of a date field:

add_filter( 'rwmb_meta', function( $value, $field_id, $args, $object_id ) {
if ( $field_id === 'event_date' ) {
$value = date( 'F j, Y', strtotime( $value ) );
}
return $value;
}, 10, 4 );