How to use wp_insert_post with cloneable field group

Support MB Group How to use wp_insert_post with cloneable field groupResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #32267
    luigi gaudinoluigi gaudino
    Participant

    Hi,
    i'm using wp_insert_post with metabox field correctly, but i'm not sure about i have to use wp_insert_post with cloneable field group.

    Can you help me?

    #32268
    luigi gaudinoluigi gaudino
    Participant

    Sorry resolved by myself

    #32272
    Long NguyenLong Nguyen
    Moderator

    It would be highly appreciated if you share the solution in your case.

    Thanks.

    #32281
    luigi gaudinoluigi gaudino
    Participant

    Hi Long, this is my snippet:

    
    wp_insert_post( $postarr=array(
                    
    //'ID' => 0,
    //'post_author'   => ,
    //'post_date' => ,
    //'post_date_gmt' => ,
    //'post_content' => ,
    //'post_content_filtered'=> '',
    'post_title' => 'Contatti',
    //'post_excerpt' => '',
    'post_status' => 'Publish',
    'post_type' => 'forms',
    //'comment_status' => '',
    //'ping_status'   => '',
    //'post_name' => '',
    //'to_ping' => '',
    //'pinged' => '',
    //'post_modified' => '',
    //'post_modified_gmt' => '',
    //'post_parent'   => '',
    //'menu_order'    => '',
    //'post_mime_type' => '',
    //'guid' => '',
    //'import_id' => '',
    //'post_category' => '',
    //'tags_input' => '',
    //'tax_input' => '',
    'meta_input' =>[
      'form_action'   => '#form-Contatti',
      'form_method'   =>  'POST',
      'form_value'    => 'INVIA',
      'form_campo' => [ //group ID
        [ 'form_campo_nome'=>'nome', 'form_campo_tipo'=>'text', 'form_campo_label'=>'Nome', 'form_campo_placeholder'=>'Inserisci il tuo nome' ],
        [ 'form_campo_nome'=>'email', 'form_campo_tipo'=>'email', 'form_campo_label'=>'Email', 'form_campo_placeholder'=>'Inserisci la tua email' ],
        [ 'form_campo_nome'=>'messaggio', 'form_campo_tipo'=>'textarea', 'form_campo_rows'=>'4', 'form_campo_cols'=>'50', 'form_campo_label'=>'Messaggio', 'form_campo_placeholder'=>'Inserisci il tuo messaggio' ]
      ]
                        
    ]
                    
    ), $wp_error=false, $fire_after_hooks=true );
    
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.