'post','numberposts'=>-1,'post_status'=>'any', 'fields'=>'ids','meta_key'=>'_carta_id','meta_value'=>$CARTA]); $es_ids = array_merge($es_ids, $arts); $all = []; foreach ($es_ids as $id) foreach (pll_get_post_translations($id) as $tid) $all[$tid]=true; $all = array_keys($all); $now = current_time('mysql'); $now_gmt = current_time('mysql', true); $pub=0; $skip=0; $fixed=0; foreach ($all as $id) { $p = get_post($id); if(!$p) continue; if ($p->post_status === 'publish') { $skip++; continue; } $data = ['ID'=>$id, 'post_status'=>'publish']; if (strtotime($p->post_date_gmt) > strtotime($now_gmt)) { // fecha futura -> a ahora $data['post_date']=$now; $data['post_date_gmt']=$now_gmt; $fixed++; } $r = wp_update_post($data, true); if (is_wp_error($r)) { echo "ERR #$id: ".$r->get_error_message()."\n"; continue; } clean_post_cache($id); $pub++; } echo "Publicados: $pub | ya estaban: $skip | fechas futuras corregidas: $fixed\n";