is it possible to regenerate the slugs programmatically after changing the titles of the post? Numerous post titles were updated and the slug was not updated with the title so I need to regenerate all these slugs.
Yes, it is possible.
Sample code, has to be tested and refined:
I just made this up, there are probably some errors and egde cases, but it should give you an idea. Also, this may take a while, so it could be useful to split the update into smaller chunks.
I was trying the method suggested by Toscho, which is the "instinctive one", but in many cases it doesn't work (cf the core code to get what I mean by "many cases").
Looking in the code, I found the
By calling this filter, and changing the value of
I edited the documentation, so that more people can find this workaround if needed.
This plugin also does the job: http://www.jerrytravis.com/598/wordpress-plugin-to-generate-post-slugs
However, as it only does it for posts which don't have a slug yet, if you need to regenerate slugs edit the following line in the plugin:
for example, you could change it to: