If meta_value of meta_key is less than today’s date update meta key

UPDATE: 2/28/18

Since you need to update all the posts in a particular taxonomy, it sounds like you need to read up on how WP_Query() works.

Here’s a simple loop to get you started that will fetch all posts in a taxononmy, and update them if the “now is later than then” condition is met.

$nitish_args = array(
    'post_type' => 'post',
    'tax_query' => array(
        array(
            'taxonomy' => 'YOUR TAXONOMY HERE',
        ),
    ),
);

$nitish_query = new WP_Query( $nitish_args );

if( $nitish_query->have_posts() ){
    // Get "current" unix timestamp
    $now = time();

    while( $nitish_query->have_posts() ){
        $nitish_query->the_post();

        // Get "date" meta field as unix timestamp
        $then = strtotime( get_post_meta( $post->ID, 'date', true ) );
        
        if( $now > $then ){
            // $now is later than $then, update post.
            update_post_meta( $post->ID, 'status', 'NEW VALUE' );
        }
    }
    wp_reset_postdata();
}

Sounds like a simple if condition. You can run this on:

  • Cron
  • Post Views (add to single.php or use the is_singular() or is_single() functions in functions.php)
  • On post update with the save_post() action
  • In a WP_Query or archive template loop.
  • Doubtful, but even any time the site is loaded (directly in functions.php – not likely to be the place, but it’s possible depending on what you need to accomplish)

It really depends on your needs, but here’s something to get you started:

// Get "date" meta field as unix timestamp
$then = strtotime( get_post_meta( $post_id, 'date', true ) );

// Get "current" unix timestamp
$now = time();

if( $now > $then ){
    // $now is later than $then, update post.
    update_post_meta( $post_id, 'status', 'NEW VALUE' );
}

Basically you just need to get the unix timestamp of the date field, compare that to the current unix timestamp with the time() function, and then see if “now” is greater than “then”, and if so – update the post.