Search code examples
phpwordpressslug

How does Wordpress create slugs?


I am writing a script to import posts from a CSV file, but I need to generate a slug from the data source in order to query Wordpress to see if the post already exists, how does Wordpress generate the slugs? I will need to generate the slugs in the exact same way in order to correctly query the Wordpress database.


Solution

  • I found the answer, you can use the function sanitize_title().