Access Selected Taxonomy on Insert/Update from Frontend

Support MB Frontend Submission Access Selected Taxonomy on Insert/Update from FrontendResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #28227
    pluginovenpluginoven
    Participant

    According to the taxonomy field type, it does not store the taxonomy to the database (but changes the taxonomy id of the post - which is in the database, so that's confusing). Regardless, on if I add a taxonomy field to a front end form, it is displaying all the terms of the taxonomy, and even pre-selecting the term if it was previously saved in the back end. However, I can not get this value to update when saving from the front end.

    Metabox:

    'name'       => 'Veranstaltungs-Kategorien',
    'id'         => 'tribe_events_cat',
    'type'       => 'taxonomy',
    'taxonomy'.  => 'tribe_events_cat',
    'field_type' => 'select',

    I have tried using an id of:

    tribe_events_cat
    tax_input[tribe_events_cat]
    tax_input[tribe_events_cat][]
    

    with no joy.

    I am now looking to hook into:

    rwmb_frontend_insert_post_data
    rwmb_frontend_update_post_data

    to see if I can access the selected taxonomy value and manually update the post_id with the updated taxonomy term_id, but I was wondering if there is a recommended method of dealing with taxonomy and category fields using frontend submission.

    #28231
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Can you please share the code that creates meta boxes and custom fields? The field taxonomy set post-term like category or tag so it will not work as a subfield in group or block.

    If you want to access the selected taxonomy ID, you can use the variable $_POST['field_id']. See more here https://docs.metabox.io/extensions/mb-frontend-submission/#general-hooks

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