title: Update Advanced Custom Field from HTML form
body: <p>I'm using a custom php code to allow visitors to add content to my website by creating posts, using a form.</p>
  
  <p>It works fine.</p>
  
  <p>here is my PHP code :</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['submit'])){
  
      $err = array();
      $err['status'] = true;
      $output = "";
  
      if(empty($_POST['content'])){
          $err['status'] = false;
          $err['msg'][] = 'Le champ "Article" ne peut être vide.';
      }
  
      if($err['status']){
  
          $insert = array(
  
              'post_status'   =&gt; 'publish',
              'post_title'    =&gt; htmlentities($_POST['title']),
              'post_content'  =&gt; htmlentities($_POST['content']),
              'post_category' =&gt; array(11),
              'post_author'   =&gt; 999,
              'tags_input' =&gt; htmlentities($_POST['tags']),
  
          );
  
         // $tags = $_POST['post_tags'];
          $post_id = wp_insert_post($insert);
  
          if($post_id != 0){
  
              $user_meta_values = array(
                  'pseudo'    =&gt; htmlentities($_POST['pseudo']),
                  'mail'      =&gt; $_POST['mail']
              );
              $output = add_post_meta($post_id, "user_meta", json_encode($user_meta_values)) ? 'Article inséré avec succès.' : 'Une erreur est survenue lors de l\enregistrement.' ;
          }
  
      }
  
      else{
          foreach($err['msg'] as $k=&gt;$v)
              $output .= $v . '&lt;br /&gt;';
      }
  }
  ?&gt;
  </code></pre>
  
  <p>and my HTML form :</p>
  
  <pre><code>&lt;form method="post" action="&lt;?php echo site_url().'/ajouter'; ?&gt;"&gt;
      &lt;p&gt;&lt;label for="pseudo"&gt;Nom&lt;/label&gt;&lt;input type="text" name="pseudo" id="pseudo" value="" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label for="mail"&gt;Mail&lt;/label&gt;&lt;input type="text" name="mail" id="mail" value="" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label for="title"&gt;Titre&lt;/label&gt;&lt;input type="text" name="title" id="title" value="" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label for="content"&gt;Article&lt;/label&gt;&lt;textarea name="content" id="content" rows="10" cols="15"&gt;&lt;/textarea&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label for="tags"&gt;Tags&lt;/label&gt;&lt;input type="text" name="tags" id="tags" value="" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label for="ACF_texte"&gt;ACF_texte&lt;/label&gt;&lt;input type="text" name="ACF_texte" id="ACF_texte" value="" /&gt;&lt;/p&gt;
  
      &lt;p&gt;&lt;input type="submit" name="submit" value="enregistrer" /&gt;&lt;/p&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>On every posts, I have advanced custom fields. One is for example called "text_ACF". Using the same method, I would like to be abble to get text from my form, and insert it inside my Advance Custom Field (text_ACF).</p>
  
  <p>something like this in my php :</p>
  
  <pre><code>'ACF_custom_field_name' =&gt; htmlentities($_POST['text_ACF']),
  </code></pre>
  
  <p>and in my HTML :</p>
  
  <pre><code>&lt;p&gt;&lt;label for="text_ACF"&gt;ACF_texte&lt;/label&gt;&lt;input type="text" name="text_ACF" id="text_ACF" value="" /&gt;&lt;/p&gt;
  </code></pre>
  
  <p>I don't know how to do it, how to refer to my advanced custom field. Can anybody help me with this ?</p>
  
  <p>Thanks a lot,</p>
  
  <p>And also I would like the user to be abble to upload images also, to images fields...</p>