0

I searching out for removing a special character from the permalink. Wordpress replaced this character Ø for an o but this is not what I want.
If the character is Ø remove this and do not replace for an other character.

What I tried

add_filter( 'sanitize_title', function( $title ) {

    if ( FALSE !== strpos( $title, 'Ø' ) ) {
        $title = str_replace( 'Ø', ' ', $title );
    }

    return $title;

}, 11 );

But this does nothing.

Who can help me with this?

1
  • Where do you run this code from? It works perfectly in functions.php.
    – Max Yudin
    Nov 11 '21 at 19:33
0

to achieve that is not easy, this to say almost impossible, the permalinks are made by the slugs, and the slugs have a function called sanitize_tittle(), this is probably what is doing that to your permalink.

A slug consists of solely lowercase alphanumeric characters, dashes and underscores, without 2 or more dashes in a row (sequences of underscores are allowed). Furthermore, a slug cannot start or end with a hyphen.

This to say that for all I know isnt possible, only changing the wordpress functions that make the slugs, but doing that can probably bring you some issues at long term on your permalinks, also can disapear on a wordpress update. anyhow is that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.