| 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/3951577/root/tmp/ |
Upload File : |
<?php
if ( ! function_exists('pll_get_post_language') ) { WP_CLI::error('Polylang missing'); }
$types = array('post','page','smi_tool','smi_comparison','smi_product','smi_glossary');
$q = get_posts(array('post_type'=>$types,'numberposts'=>-1,'post_status'=>'publish','fields'=>'ids','suppress_filters'=>true,'lang'=>'en'));
$fixed = 0;
foreach ($q 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;
// Neu setzen – Polylang erlaubt jetzt gleiche Slugs je Sprache.
wp_update_post(array('ID'=>$id,'post_name'=>$base));
$new = get_post_field('post_name', $id);
echo " $id: $slug -> $new\n";
$fixed++;
}
echo "Fixed $fixed slugs.\n";