i am crating a front end form to upload custom metafields in a taxonomy using a webhook

43 views Asked by At

"Hi, I created a front-end form using Jet Forms to create an entry in a taxonomy. The 'name' value works well, but I use Jet Engine to add custom metafields to the taxonomy. I want to fill those metafields using the front-end form. The method I'm using involves a webhook, but something isn't working – only the name is getting updated."

add_action( 'jet-form-builder/custom-action/crear_cliente', function( $request, $action_handler )   {

    $terms = explode(',' , $request['Nombre']);
    $taxonomy= 'cliente'; // Replace with your actual taxonomy name
 foreach ($terms as $term) {
    // Check if the term already exists
    $existing_term - term_exists($term, $taxonomy);
    // If the term doesn't exist, create it
    if ($existing_term === 0 || $existing_term === null) {
        wp_insert_term($term, $taxonomy);
        
            // Fill meta fields for the term
            update_term_meta($term_id, 'telefono', $request['Telfono']);
            update_term_meta($term_id, 'correo', $request['correo']);
            
      
    }
}

i want the front end form to add all the information in the taxonomy custom meta fields

0

There are 0 answers