Support MB Custom Table Showing decimal field leave extra zeros at the end. Any filter to solve that? Reply To: Showing decimal field leave extra zeros at the end. Any filter to solve that?

#13705
Anh TranAnh Tran
Keymaster

Hi Camilo,

I got it. So if you use the helper function rwmb_meta to get the value, you can use a filter to remove the extra zeros. This is the filter:

apply_filters( 'rwmb_meta', $meta, $key, $args, $post_id );

So you can do something like this:

add_filter( 'rwmb_meta', function( $meta, $key, $args, $post_id ) {
    if ( 'your_field_id' === $key ) {
        $meta = your_function_remove_extra_zeros( $meta );
    }
    return $meta;
}, 10, 4 );