How can I Bulk Re - Activate Listing that Expire

Discussion in 'GeoCraft WordPress Theme' started by n2rga, Jun 25, 2013.

Thread Status:
Not open for further replies.
  1. n2rga

    n2rga Member

    Joined:
    Apr 14, 2013
    Messages:
    44
    Likes Received:
    4
    Location:
    WWW
    I have searched and the answer to this question was not answered.
    Please let me know how I can bulk Activate Expired listing.
    Please don't tell me I have to do 8,000 Listing Manually
     
  2. Gourav

    Gourav Support Staff

    Joined:
    Oct 19, 2012
    Messages:
    7,728
    Likes Received:
    207
    Hello,

    There is one more update for you.
    Add code given below in the function.php and remove it after listing publish.

    Code:
    global $wpdb;
    $data="SELECT * FROM wp_posts WHERE post_status = 'draft'";
    $queries = $wpdb->get_results($data);
    foreach ($queries as $query) {
    echo $post_id=$query->ID;
    $meta_key='gc_listing_duration';
    $post_status='post_status';
    $posttable='wp_posts';
    $meta_value='06/20/2013 07:15:45';
    update_post_meta($post_id, $meta_key, $meta_value);
    $wpdb->update($posttable,array($post_status =>'publish'), array( 'ID' =>$post_id ),array('%s'),array( '%d' ));
    }
    Change date and time in $meta_value. But keep in same format as now.
     
  3. n2rga

    n2rga Member

    Joined:
    Apr 14, 2013
    Messages:
    44
    Likes Received:
    4
    Location:
    WWW
    thank you
     
Thread Status:
Not open for further replies.

Share This Page