Tet banner

Custom Fields
Support MB Frontend Submission How to modify data of custom field which will be stored in custom table

  • Creator
  • #30601

    Hi, I want to use hook rwmb_frontend_insert_post_data and rwmb_frontend_update_post_data to modify custom field data in submitted post data. For example, an custom fields, called calorie, whose data type is hidden is stored in a custom table. I tried to use the following code to modify the data of calorie but failed.

    add_filter( 'rwmb_frontend_insert_post_data', function( $data, $config ) {
        // Make sure you work on the correct form.
        if ( 'diet_form' !== $config['id'] ) {
            return $data;
        $data['calorie'] = '100';
        return $data;
    }, 10, 2 );

    Is there a trick I'm not aware of?


Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.