I am trying to convert a post title to a slug. I used sanitize_title_with_dashes
, thinking that's what WordPress uses. However, if my post title has an apostrophe in it, sanitize_title_with_dashes
does not strip out the apostrophe. Instead, it escapes the apostrophe with a backslash.
For example, if I use the default post editor to create a post named "Bob's Boutique", WordPress core will correctly create the slug as "bobs-boutique".
If I try to convert "Bob's Boutqiue" to a post slug using sanitize_title_with_dashes
in functions.php, the result is "bob\'s-boutique".
Is there an additional function that WordPress uses when making slugs that strips out apostrophes?
echo sanitize_title_with_dashes("Bob's Boutqiue")
outputsbobs-boutique
, I don't get an escaped quote.