title: Wordpress update_post_meta caching old value
body: <p>I'm trying to update a wordpress meta field and then display that new value once a form has been successfully submitted. </p>
  
  <p>The field is actually getting updated but it seems like Wordpress is caching the old value when the page is reloaded. </p>
  
  <p>Here's my code...</p>
  
  <pre><code>&lt;?php
      if (!isset($_GET['pid'])) 
          header('Location: ' . get_bloginfo('wpurl'));
  
      $query = new WP_Query(array('post_type' =&gt; 'vacancies', 'p' =&gt; $_GET['pid']));
      $meta  = get_post_meta($_GET['pid']);
      $date  = DateTime::createFromFormat('Y-m-d', $meta['closing-date'][0]);
  
      if (isset($_POST['closing-date']) &amp;&amp; $_POST['closing-date'] != '' ) 
      {
          if ($_POST['confirmation'] == $confirmation)
          {
              $dt = DateTime::createFromFormat('d/m/Y', $_POST['closing-date']);
              update_post_meta($_GET['pid'], 'closing-date', $dt-&gt;format('Y-m-d'));
              echo 'Success';
          } 
          else 
          {
              echo 'There was an error';
          }
      } 
  ?&gt;
  
  &lt;form method="post" action="http://&lt;?php echo $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] ?&gt;"&gt;
      &lt;input name="closing-date" type="text" value="&lt;?php echo $date-&gt;format('d/m/Y') ?&gt;" class="datepicker form-control" /&gt;
      &lt;input name="confirmation" type="text" class="form-control" /&gt;
      &lt;input type="submit" id="gform_submit_button_14" class="button button-secondary" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Can anyone tell me what's happening and how I can clear it? I've tried resetting the WP_Query object but that didn't seem to work.</p>
  
  <p>Thanks</p>