0

How can I change the - to a + in the URLs, automatically?

http://website.com/post-name/
http://website.com/post+name/
4
  • Do you want to do it manually or automatically when the post is created?
    – Anagio
    Commented Mar 12, 2013 at 7:33
  • yes automatically Commented Mar 12, 2013 at 7:47
  • What is your permalink structure (update your question please)?
    – kaiser
    Commented Mar 12, 2013 at 8:41
  • have you tried custom structure in Permalink settings?
    – MidhuN
    Commented Mar 12, 2013 at 8:47

1 Answer 1

0

The post slug is generated in the wp_insert_post (…/wp-includes/post.php) function. The function calls another function to sanitize the your post title. You can use the filter sanitize_title (…/wp-includes/formatting.php) to replace - by +. This will change the behavior in more situations then just the title of a post. So you should check if it is a post title that is sanitized.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.