Accents in wordpress permalinks

UPDATE: You can find a premium version of this plugin including all accented characters here.

Several weeks ago i had the tough task to find or code a plugin that will let us keep swedish accents in wordpress permalinks. I only found one plugin that does this in the WordPress Plugin Directory, and of course it was not working… I assume it was written for some old version of wordpress. Anyways I started going through some function documentation at the codex and came up with quite simple solution, which will let you keep your language accents in wordpress permalinks.

Use a filter to replace the accents in wordpress permalinks with their UTF8 hex equivalent

I only had to find the proper filter and hook my function there. It worked perfectly below is the code of a MU Plugin for Swedish accents in wordpress permalinks.


1) Create a folder named mu-plugins in wp-content and drop the file there. That is pretty much it. The solution will work for all the blogs in your network(if you have a Multi-Site installation)

The code is pretty straight forward but if you have any questions feel free to ask.

IMPORTANT Keep you files UTFed unless you want your editor to strip the characters and mess up your permalinks afterwards. Also keep in mind that this plugin will work only for your new permalinks. Old permalinks will remain intact(you can change them manually if needed).

The example below is for swedish accents in wordpress permalinks and is downloadable as MU-plugin and as a regular plugin as well.

I`m working on uploading it in the WordPress Plugin Directory

remove_filter( 'sanitize_title', 'sanitize_title_with_dashes');
add_filter( 'sanitize_title', 'restore_raw_title', 9, 3 );
function sweURLtoCHAR($text)


$str = str_replace($char,$url,$text);
$str_new = str_replace(&quot; &quot;, &quot;&quot;, $str);
return strtolower($str_new);
function restore_raw_title( $title, $raw_title, $context ) {
if ( $context == 'save' )
return sweURLtoCHAR($raw_title);
else {
$title_new = str_replace(&quot; &quot;, &quot;&quot;, $title);
return strtolower($title_new);

In order to use this code snipplet as a regular plugin add the code below at the beginning of your php file

Plugin Name: Swedish accents in permalinks
Plugin URI:
Description: Allows Swedish accented characters in permalinks
Version: 2.0
Author: Pavel (aka Immortal) Petrov
Author URI:
License: GPL2

You can read more about the WordPress standards of creating plugins in the Codex of course.

PS. If you code this use UTF8 without BOM, because otherwise you`ll get “Warning: Cannot modify header information – headers already sent by…”

  • I’ve been setting up WordPress since the first veorisn of All in One SEO Pack. You would to use All in One in conjunction with some essential free plugins as a foundation and one or two premium SEO plugins.This is the configuration that I was personally recommended and have been using on my websites ever since with all of them “maintain” #1 #3 rankings on Google for their primary and secondary keywords:All-in-One SEOEasy WP SEOGoogle XML SitemapsSEO Friendly ImagesDagon Sitemap GeneratorPingback Optimizer

    • I have about 30 blogs on WordPress platforms I would reemmocnd these plugins:Platinum SEOGoogle XML SitemapsW3 Total Cache that should be all you need to get rolling

      • admin

        I`ve been having different problems with W3 Total cache on a WordPress Multisite installed on an OpenVZ VPS…it was actually making the site slower, Google XML Sitemaps(with MultiSite support) also needs a lot of work related to internationalized domain names and sites mapped to a separate domain(and maybe memory optimizations, because I`ve seen it use up to 25MB memory for a single sitemap)….

  • First, I advice you not to use too many pinulgs. This will affect the performance of your website negative.I use for my wp blogs:All In one SEO PackGoogle XML SitemapsWP Super Cashe

  • Hello I am so excited I found your website, I really found you by accident, while I was looking on Aol for something else, Regardless
    I am here now and would just like to say cheers for a
    tremendous post and a all round entertaining blog (I also love
    the theme/design), I don’t have time to read through it all at the moment but I have book-marked it and also added your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the awesome job.

  • Just wish to say your article is as astounding.

    The clearness in your post is simply cool and that i can assume you’re a professional on this subject. Fine along with your permission allow me to grab your feed to keep up to date with drawing close post. Thanks one million and please continue the enjoyable work.

  • Hi outstanding blog! Does running a blog similar to this take a lot of
    work? I have absolutely no expertise in programming but I had been hoping to start my own blog soon.
    Anyways, should you have any suggestions or tips for new blog owners please share.
    I understand this is off topic however I simply needed to ask.
    Appreciate it!

    • admin

      Blogging is easier then ever, especially having WordPress around…Solutions for any problems you might stumble upon can easily be found in wordpress forums, stackoverflow, and of course here. If you have any particular
      questions feel free to contact me at contact AT

  • Thanks for some other excellent post. The place
    else could anyone get that type of information in such a perfect manner of writing?
    I’ve a presentation next week, and I am at the search for such info.

  • very good put up, i definitely love this web site, keep on it

  • Hello there! Do you use Twitter? I’d like to follow you if that would be okay. I’m definitely enjoying your blog and look forward to new posts.

    • admin

      I added twitter button to the right menu..I`ll be posting there too from now on 🙂
      Thanks for the comment!

  • هاست پربازدید,هاست پر ترافیک,طراحی سایت

    My brother suggested I may like this website. He was once totally right. This submit actually made my day. You can not imagine just how much time I had spent for this information! Thank you!

  • Garth

    Thanks. This really helped me out!

  • This code cause error in attachment pages. If attachment has accented slug, it runs into error 404. Do you have any idea, how to fix this?