IIRC / is a ‘reserved’ character in the slug and cannot be used.
That’s a general WP issue, not MultiSite. I also can’t think of ways to ‘auto-fix’ that. You’d have to go to each post and edit the slug :/
Thread Starter
stipto
(@stipto)
Ha! That’s only a last-resort-solution with over 5.000 posts.
It also happens with characters like ! and ‘ so not only the /
And this problem only occurs on my imported articles. When I create a new one, it generates a good slug.
So maybe I can perform a query in SQL that finds all url’s that have these reserved characters and replaces them by valid things? Only I wouldn’t know how to write this.
I’ve never tried (ow, 5000!)
If possible, I’d dump the posts (all of ’em) and see if you can re-import with ‘clean’ URLs. If not….
WHAT FOLLOW IS ALL UNTESTED THEORY!!!!
This post on “Transliterate existing cyrillic slugs (post_name) in wordpress” may help: http://snipplr.com/view/50246/transliterate-existing-cyrillic-slugs-postname-in-wordpress/
So you’d want something like
$iso = array(
"!"=>"-","/"=>"-"
);
And so on.
Thread Starter
stipto
(@stipto)
Hey Ipstenu,
Thanks for your help. I couldn’t fix it yet though.. I know the basic SQL query but the special characters give errors. This is what I got thusfar:
update wp_posts set post_name = replace(post_name, ‘find this string’, ‘replace found string with this string’);
As I found out, the slug is in the post_name field in wp_posts.
The only thing I need to know is how insert those special characters into the ‘find this string’ part. If I insert a ‘ then it gives me this error: #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ”’, ‘-’)’ at line 1
I think it’s because your quotes are ‘smart’ quotes…
update wp_posts set post_name = replace(post_name, 'find this string', 'replace found string with this string');
Thread Starter
stipto
(@stipto)
Do you mean that I didn’t fill in the string? The actual queries I’m trying are like this:
update wp_posts set post_name = replace(post_name, ‘:’, ‘-‘);
Or
update wp_posts set post_name = replace(post_name, ‘?’, ‘-‘);
Now I don’t know what ‘smart’ quotes mean.
Hey and thanks for helping me this much, really appreciate it!! 🙂
Smart Quotes: http://en.wikipedia.org/wiki/Quotation_mark_glyphs
And … you have to use special kinds of quotes in various places here…
AND since WordPress’s form will EAT those quotes, read this: http://forums.mysql.com/read.php?10,405739,405745#msg-405745
That’s the specific kind of quotes you’ll need 🙂
Thread Starter
stipto
(@stipto)
You’re totally right! Thanks!! I’m able to do everything I need now.
+1 for you.