Powered by WHUK®

Announcement

Collapse
No announcement yet.

How to convert single quotation marks to dash in WordPress permalinks?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to convert single quotation marks to dash in WordPress permalinks?

    I observed if I create a page with the title "It's looking good" the generated permalink is looking like "its-looking-good". I need it to become "it-s-looking-good" by default.

    How can I change this permalinks structure?

  • #2
    It's clean out with sanitize_title_with_dashes() by the sanitize_title filter at priority 10 (source), so you can replace single quotation marks with a dash, just before with:

    Code:
    add_filter( 'sanitize_title', function( $title )
    {
        return str_replace( "'", "-", $title );
    }, 9 );

    Comment

    Working...
    X