When did ['post_id'] became ['object_id'] in the $config??

Support MB Frontend Submission When did ['post_id'] became ['object_id'] in the $config??

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #47246
    YasmineYasmine
    Participant

    Did Meta Box change how it handles the post_id configuration for frontend submissions?? I relied on the post_id attribute in the $config array during frontend submissions to manage post-related actions. However, I noticed that post_id is now being returned as 0, while the correct ID is available under object_id. This meant my custom logic was failing until I explicitly added a fallback to use object_id when post_id equals 0. Was this changed and if so when??

    I use in these sorts of scenarios and I imagine others do too:

    add_filter( 'rwmb_frontend_redirect', function( $redirect, $config ) {
        if ( 'my_form_ID' !== $config['id'] ) {
            return $redirect;
        }
    
        $post_id = isset($config['post_id']) ? (int) $config['post_id'] : null;
    #47247
    YasmineYasmine
    Participant

    PS - I will be very happy if you tell me it did not change, and it was me that had somehow changed this code!

    #47254
    PeterPeter
    Moderator

    Hello Yasmine,

    Yes, we change post_id to object_id for the frontend form from Meta Box AIO 1.31.0 to support the compatibility between the custom model and frontend form. That means you can submit a custom model entry from frontend.
    You can read more about this update in the changelog https://metabox.io/plugins/meta-box-aio/changelog/
    and documentation https://docs.metabox.io/extensions/mb-frontend-submission/#adding-the-submission-form

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