What function removes apostrophes when making a slug?

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?

Topic sanitization slug Wordpress

Category Web


Use this function to remove the apostrophe:

preg_replace( "/[:’]/", "", $title );

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.