Home Forums General Issues Update Age Every Day Reply To: Update Age Every Day

  • If your database of talent grows it is very likely that your cron will time out with all the queries that would need to be performed to update every age. For a large DB your cron would need to be set up on the server, no by using WP cron functions and would also likely need to be created in a way that checks how long it’s been running or is some other way be built so that the task can be done over several cron calls.

    I would still use the date field. Let’s say that someone wants to only see people that are over 30 or over.

    // format a date to string to search for
    $query_date = date('Ymd', strtotime('-30 Years'));

    then the meta query

    $meta_query = array(
        'key' => 'date_of_birth',
        'value' => $query_date,
        'compare' '<='