| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/self/root/tmp/ |
Upload File : |
<?php
global $wpdb;
$types = array("post","page","smi_tool","smi_comparison","smi_product","smi_glossary");
$en = get_posts(array("post_type"=>$types,"numberposts"=>-1,"post_status"=>"publish","fields"=>"ids","suppress_filters"=>true,"lang"=>"en"));
$fixed=0;
foreach($en as $id){
if(pll_get_post_language($id)!=="en") continue;
$slug = get_post_field("post_name",$id);
$base = preg_replace('/-\d+$/','',$slug);
if($base===$slug) continue;
// Kollidiert die Basis mit einem ANDEREN EN-Post? (gleiche Sprache => echte Kollision)
$clash=false;
foreach($en as $oid){ if($oid==$id) continue; if(pll_get_post_language($oid)==="en" && get_post_field("post_name",$oid)===$base){ $clash=true; break; } }
if($clash){ echo " SKIP $id ($slug) – EN-Kollision\n"; continue; }
// Direkt in DB setzen (umgeht wp_unique_post_slug; Polylang trennt per Sprache).
$wpdb->update($wpdb->posts, array("post_name"=>$base), array("ID"=>$id));
clean_post_cache($id);
echo " $id: $slug -> $base\n";
$fixed++;
}
echo "Fixed $fixed slugs.\n";