title: Wordpres Cron Jobs - Changing post meta after set time
body: <p>I'm having trouble getting a cron job working in wordpress.</p>
  <p>Setup:
  I have a custom post type ('jobs') that have a couple of meta fields:
  'featured' (bool) set to true if it is featured and
  'feature-expiry' (DateTime) which is the time that the feature expires.</p>
  <p>Goal:
  Once the feature-expiry time has passed, update the post meta and change 'featured' to false</p>
  <p>I'm kindof new to php and I can't seem to get it to work. The cron job fires fine but the posts aren't being updated, what am I doing wrong?</p>
  <pre><code>/*           jj cron jobs              */
  
  function jj_feaurecheck_cron_function( ) {
  
    global $post;
  
    $args = array( 
      'post_type'       =&gt; 'jobs',
      'posts_per_page'  =&gt; -1,
    );
  
    $listings = get_posts( $args );
      foreach($listings as $post) : setup_postdata($post);
  
      $today = date( 'Ymd' );
      $expire = get_field( 'feature-expiry', false, false );
      $status = get_field( 'featured' );
          if ( $expire &lt; $today ) :
              $status = 'false';
              update_field( 'featured', $status );
          endif;  
      endforeach;
  
  }
  if ( ! wp_next_scheduled( 'jj_feaurecheck_cron' ) ) {
      wp_schedule_event( date( 'Ymd' ), 'daily', 'jj_feaurecheck_cron' );
  }
  add_action( 'jj_feaurecheck_cron', 'jj_feaurecheck_cron_function' );
  </code></pre>
  <pre><code></code></pre>