1. Home
  2. ReHub Theme
  3. Advanced tips and customizations
  4. How to make post expired based on negative voting

How to make post expired based on negative voting

add_action('rh_overall_post_likes_add', 'set_expired_negative');
function set_expired_negative(){
   $post_id = intval( $_POST['post_id'] );
   $hotcount = get_post_meta($post_id, 'post_hot_count', true);
   if($hotcount && $hotcount < 10){
       update_post_meta($post_id, 're_post_expired', 1);            
       wp_set_object_terms($post_id, 'yes', 'offerexpiration', false ); 
   }
}

Place in functions.php of child theme