• I am using Formidable Forms to allow my users to create new posts on my site and one of the form fields is a text input where the user will include their business’s “Parking Instructions”. I have a custom taxonomy “Parking Instructions” but how to I get the value which the user inputs into the form’s text field to create a new term within the Parking Instructions taxonomy?

    I cannot edit the code of the form to include the taxonomy as a text field so I have to manually link the value passed from the form to the taxonomy. I have tried using create_term and wp_insert_term( $term, $taxonomy, $args = array() ); but I cannot figure out how to dynamically get the value for $term so that the correct form field will populate the custom taxonomy with a new term.

    Anyone got any ideas?
    Thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter SJS719

    (@sjs719)

    I figured out how to create a new term for my taxonomy with the content that the user enters into the form text field using the following function:

    $term = FrmProEntriesController::get_field_value_shortcode(array('field_id' => 144, 'entry_id' => '40'));
    
    wp_insert_term( $term, 'instructions');

    But the issue is that while this function will create a new term within the taxonomy “instructions”, it doesn’t actually populate the entry’s “Instructions” taxonomy, it just creates an empty term with no posts attached.

    So how do I get the new term to actually attach to the entry as the “Instructions” taxonomy?

Viewing 1 replies (of 1 total)
  • The topic ‘Create New Taxonomy Term from Frontend User Form Value?’ is closed to new replies.