Hi,
The filter:
$new = apply_filters( "rwmb_{$field['id']}_value", $new, $field, $old );
means that the value of the field ($new
) will run through a filter called rwmb_YOURFIELDID_value
. This filter has 3 params:
$new
: the submitted value of the field
$field
: field settings (array)
$old
: the current value of the field, which is stored in the custom field. If field is new, then it's an empty string.
So, to add a filter to change the field value, please run:
add_filter( 'rwmb_YOURFIELDID_value', function( $new, $field, $old ) {
$new = 'Your new value';
return $new;
}, 10, 3 );
Just add it to your functions.php
file of your theme. That's all.
Hope that's clear ๐