AIO 1.31.0 Not Saving Group Fields via API

Support Meta Box AIO AIO 1.31.0 Not Saving Group Fields via APIResolved

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #47015
    CameronCameron
    Participant

    There is a bug in AIO 1.31.0 that will not save a Group field when using a POST API call to /posts/post_ID. The payload will look correct on the output response, but if you GET the same post immediately after, the Group field is unchanged.

    Rolling back to AIO 1.30.5 fixes the problem.

    #47022
    PeterPeter
    Moderator

    Hello Cameron,

    Can you share the group field settings and sub-fields that you try to update the value via POST API? I try with simple group field

    'fields'   => [
        [
            'name'              => __( 'Group', 'your-text-domain' ),
            'id'                => $prefix . 'group_ubce2rqmfm',
            'type'              => 'group',
            'fields'            => [
                [
                    'name'              => __( 'Text', 'your-text-domain' ),
                    'id'                => $prefix . 'text_wulikp8w5km',
                    'type'              => 'text',
                ],
            ],
        ],
    ],

    and I can update the subfield text value with POST API properly when using the latest version MB AIO 1.31.0.
    Also, do you use any caching plugins on your site or on your hosting? Please disable them all and recheck this issue.

    #47049
    CameronCameron
    Participant

    Hi Peter,

    I have a Group called Highlights Group with fields called Highlights within. This Custom Field is stored in a Custom Table.

    I've previously been updating it successfully like this:

    {
        "meta_box": {
            "HighlightsGroup": [
                {
                    "highlight": "This is a test"
                }
            ]
        }
    }
    

    The output payload shows as successful, but using a GET command right after the field will not be updated.

    This stopped working in 1.31.0 but works in 1.30.5 .

    #47059
    PeterPeter
    Moderator

    Hello,

    Thanks for the details. I also see the data is not inserted into the custom table. There could be an issue with the Rest API and custom table in the new version. I will inform the development team to check and fix it soon.

    #47280
    CameronCameron
    Participant

    Peter, any chance this was fixed in 1.31.1?

    #47283
    Tan NguyenTan Nguyen
    Participant

    Dear Cameron,

    I have checked MB Rest API and found no issues, please make sure you have set 'clone' => true to **HighlightsGroup** field. Here is the meta box that have similar structure with yours.

    
    add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) {
        $meta_boxes[] = [
            'title' => 'Test',
            'fields' => [
                [
                    'name' => 'HighlightsGroup',
                    'id'   => 'HighlightsGroup',
                    'type' => 'group',
                    'clone' => true,
                    'fields' => [
                        [
                           'name' => 'highlight',
                           'id'   => 'highlight',
                           'type' => 'text',
                        ],
                    ]
                ],
            ],
        ];
        return $meta_boxes;
    } );
    

    Since your **HighlightsGroup** field expects an array, you have to set clone => true.

    Otherwise, if you don't want cloneable group, here is the correct json format:

    
    {
        "meta_box": {
            "HighlightsGroup": {
                "highlight": "This is another test"
            }
        }
    }
    

    Cheers!

    #47373
    CameronCameron
    Participant

    Hello, this is still an issue in AIO 1.31.1.

    I send this payload:

    {
        "meta_box": 
           {
      "HighlightsGroup": [
        {
          "highlight": "This is a Test"
        }
      ]
    }
    }

    ...the response received will be correct and seems to be updated, but when you view the actual post or database, nothing has changed.

    Roll back to 1.30.5 and it works!

    Tan, I double checked that clone is set to true when I tested with both versions. It will work correctly in 1.30.5, just not 1.31.0 or 1.31.1.

    #47374
    CameronCameron
    Participant

    Can we mark this as not resolved?

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