Générateur de Slugs WordPress

WordPress builds slugs automatically with its core sanitize_title() function — but what it generates is often not what ranks. Default behavior keeps stop words ("the", "and", "how-to-choose-the-best-running-shoes-for-you"), producing long URLs that get truncated in search results; preview and trim the slug here first, then paste it into the post's URL field before publishing. Where manual slugs matter most: programmatic imports with wp_insert_post() (set post_name explicitly or WordPress appends -2 to every collision silently), WooCommerce products whose permalinks inherit messy supplier titles, and custom post types where the rewrite slug in register_post_type() plus each post's own slug together form the URL. Turkish, German and other non-English sites should double-check transliteration: sanitize_title() percent-encodes characters it cannot map, which yields ugly %c3%bc sequences in some server configs — generating a clean ASCII slug here avoids that entirely. And the golden rule of established WordPress sites: changing a published slug without a 301 (Redirection plugin or .htaccess) throws away every backlink and ranking the old URL earned.

// WordPress core helper
$slug = sanitize_title('Merhaba Dünya SEO'); // merhaba-dunya-seo

// When inserting a post programmatically
wp_insert_post([
    'post_title' => 'My New Article',
    'post_name'  => sanitize_title('My New Article'),
    'post_status'=> 'publish',
]);