Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

SEO vs. Unicode After a major load of 404 with some category and tag URL, I questioned on StackOverflow about my WordPress blog. My blog is in Unicode Bānglā. After a nice anatomy on the fact in Facebook1 with some CodeGeeks, we came to a solution for both 404 on Unicode characters and SEO for Unicode sites.

THE IDEA
Mr. Sarim Khan (the Gittu) suggested a nice solution for a URL:

  • For category: http://www.example.com/category/astronomy/জ্যোতির্বিজ্ঞান‌‌‌‌‌‌‌‌‌
  • For posts: http://www.example.com/%postid%/আমার-পোস্টটি-যে-বিষয়ে

For this case the article will browse with the preceding category /astronomy, and will work for English SEO too. And the rest of the section /bānglā-slug would work for Bānglā SEO, and with this method the 404 can be minimized to a great extent.

But for a nice URL with Bānglā contents, I can manage my post and page URL, when I'm writing my page or post. But for Bānglā tags, and categories, how can I achieve such a modified URL? How can I put a Bānglā and English tag/category (taxonomy) at a time?

REAL QUESTION
Currently I'm following http://domain/%postname%. How can I rewrite my URL, so that I can achieve such a benefit of lesser 404 for Unicode URL, and also doesn't get down in SEO chase.

Desired URL is:
http://domain/%english-slug%/%bangla-slug%

And of course: Is that really possible?

1. Facebook thread image: I'm afraid, most of the discussion was in Bānglā.

share|improve this question
    
I am not sure I understand the problem. The 404s come from broken copy & paste or dumb crawlers. There isn’t much you can do about that. Adding a trailing slash will help a little bit. If you want an English slug for a Bangla Category, just edit the slug in the category manager. –  toscho Oct 12 '13 at 8:47
    
@toscho http://www.prothom-alo.com/economy/article/55104/কোরবানির_পশুর_চামড়ার_দাম_নির্‌​ধারণ‌ is a URL used by The Daily Prothom Alo - a popular Bangla Newspaper. It may be a different framework or CMS, I don't care, but it's recently done - I guess to make the site more SEO-friendly. Yes you are right I can put English slug by editing the Category/Tag, but what about posts? If I activate the %postname% permalink it activates a /postname for my post URL. How can I make it understand to put the post_id first and then with a slash my Bānglā slug. And when I'm writing a post, I'm... –  Mayeenul Islam Oct 12 '13 at 9:01
    
...assigning it to a category or tag and the slug creates for it automatically. How can I make the WP understand that I want a path for the category like 'take the English slug first and then put a Bānglā slug there after? I have to edit categories and tags - I don't want it that way. If I want it be done automatically, then isn't it preferred? –  Mayeenul Islam Oct 12 '13 at 9:04
1  
"Do you want the Bangla and the English category names in the URL?" - exactly that what I need. And I want it by default with a click or code-tweak. –  Mayeenul Islam Oct 12 '13 at 9:10
2  
This would require a major rewrite of the existing add term metabox. Adding a slug field to the term edit pages and using that in an URL is simple. Writing a new metabox for that is rather time consuming. –  toscho Oct 12 '13 at 9:20
show 1 more comment

1 Answer

If you write your post titles in Bānglā but set the post slug in English, you can do this:

 function wpse117090_pre_post_link( $permalink, $post ) {
    return str_replace( '%posttitle%', sanitize_title( $post->post_title ), $permalink );
 }

 add_filter( 'pre_post_link', 'wpse117090_pre_post_link', 10, 2 );

Then change your permalink structure to, for example, /%postname%/%posttitle%/

(Please note that the above code doesn't make %posttitle% an actual queryable rewrite tag, it's just a simple string that gets replaced by the sanitized post title when the permalinks are created.)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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