Possible to use filters (rwmb_{$field_id}_html) when using custom tables?

Support MB Custom Table Possible to use filters (rwmb_{$field_id}_html) when using custom tables?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #33462
    Paul de JongPaul de Jong
    Participant

    I'm using custom tables to store my data. I'd like to use the rwmb_{$field_id}_html or rwmb_{$field_type}_html filter to adjust the output in dashboard. However the filter is never called when using custom tables.

    How must I do this?

    #33472
    Long NguyenLong Nguyen
    Moderator

    Hi Paul,

    Yes, you can use this filter for any field, it is the HTML input of the field and is not affected by the value of the field (saved in a custom table or not).

    add_filter( 'rwmb_fieldID_html', function( $field_html, $field, $meta ) {
        $field_html .= '<p>Add your HTML code here</p>';
        return $field_html;
    }, 10, 3 );
    #33475
    Paul de JongPaul de Jong
    Participant

    Yup you're right, I was doing it wrong 🙂

    I noticed that the filter isn't used when the field is part of the post list table.
    Is it correct that I can only change the output there by using MB Admin Columns and creating a custom class (class Prefix_Custom_Admin_Columns extends \MBAC\Post {})?

    #33484
    Long NguyenLong Nguyen
    Moderator

    Hi,

    In the admin columns, you can use the filter rwmb_the_value to customize the output value. Please read more here https://docs.metabox.io/filters/#rwmb_the_value

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.