Custom Fields
Re-Envisioned
Support MB Frontend Submission Access Selected Taxonomy on Insert/Update from Frontend

  • Creator
    Topic
  • #28227
    pluginoven
    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.

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #28231
    Long 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 1 replies (of 1 total)
  • You must be logged in to reply to this topic.