• Resolved wackomako

    (@wackomako)


    Hi,

    I am running cron job to update the dates of jobs when they are over 2 weeks old. The date on the job gets updated on an individual page but the date on the job listings pages remains the same. I am guessing because they are stored as transients. Is there a way up clear the job transients using php? I can trigger this to happen after I update the dates.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,
    There is function to update date for job listings:

    $post_id = get_the_ID(); //get ID post
         $date = 2019-09-16 16:03:00; //set date which you want
         $gmtdate = get_gmt_from_date($date); //get GMT date for post
        $my_args = array(
                   'ID' => $post_id,
                   'post_date' => $date,
                   'post_date_gmt' => $gmtdate
                ); 
     wp_update_post( $my_args ); //update post
     wp_publish_post( $post_id ); //update all information about post to make sure that it is okey

    I hope it will help you ??

    • This reply was modified 5 years, 2 months ago by kibus90.
    Plugin Contributor Richard Archambault

    (@richardmtl)

    Do you still need help @wackomako ?

    Plugin Contributor Richard Archambault

    (@richardmtl)

    I’m marking this thread as Resolved as it’s been more than a month since the last reply. If you still need help, please do reply again and mark the thread as Unresolved!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Clear Job Listings transients’ is closed to new replies.