4

How to change space (-) sign to plus (+) sign in clean URL WordPress?

Like:

http://www.whitelotuscorporation.co.in/anax_wp/about-us/

to:

http://www.whitelotuscorporation.co.in/anax_wp/about+us/

You can see where the change need to be done— about+us instead of about-us in the URL.

1

This isn't possible without modifying a core file. The function WordPress uses for this is called sanitize_title_with_dashes You can find it in wp-includes/formatting.php on

It doesn't offer any filters, so you will need to make a change to this line:

$title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title );

I wouldn't recommend modifying core WordPress files at all, so if you do this, be sure to try it out on a test site before implementing it - and even then make sure you have everything backed up.

| improve this answer | |
0

Add the following to your .htaccess file in between the <IfModule mod_rewrite.c> tags that were created by WordPress:

RewriteCond %{HTTP_HOST}
RewriteRule ^(.*)-(.*)$ $1+$2 [R=301]

This has been tested and verified using the htaccess tester.

| improve this answer | |
  • HTACCESS method is DISASTER in this case! instead, url-generation needs to be changed! – T.Todua Jan 5 '17 at 21:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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