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.

I am having some URl issues with WordPress Basically i have different categories and for some reason whenever I have posts with exact same title...even though in "different" categories...I still have WordPress change the URl and adds like -#...where # stands for duplicate number.

like I can have links like gateway, gateway-2, gateway-3 and so on...WordPress automatically appends those numbers because they have same title...but they are all in different categories...so I need help here please....what can I do to stop wordpress from doing this and use the exact title since they are in different categories?

Thanks.

share|improve this question
    
anyone willing to help on this issue? –  grant tailor Nov 16 '11 at 9:56

2 Answers 2

This is not fixable, and there are good reasons for this.

Say we had a post with the slug 'apple', resulting in /category1/apple. What your question is asking, is how would we add another post with an identical slug, such that it's URL was /category2/apple?

If this was done:

  • If you referred to the post via its slug in a get_posts or wp_query, which post would it load? It's ambiguous
  • Those aren't the only URLs that work, if we loaded /post/apple, would it load the apple in category1 or category2?
  • What about /index.php?p=apple ?
  • What if a 3rd apple is added, that is in both category 1 and category 2, which apple should be used?

These issues are not trivial to overcome, and they will occur if you manage this. It is not in your interests to do this. I can understand the marketing reasoning, but it is not possible with posts from a technical standpoint.

If you wanted to do it, modifying the database would be necessary, but I strongly advise against this, as it would invoke a number of problems, and could leave you with either:

  • A broken wordpress
  • Access to the first 'apple' post you wrote but not the second.
  • various errors in the backend
share|improve this answer
    
i nunderstand what u mean...but i really hate that....i mean you mean no way in the wrold one can achieve to have this done even with custom CMS?....these kind of things make one start thinking of custome CMS –  grant tailor Nov 16 '11 at 15:35
    
If you did this, you would have to sacrifice something else, or things would become ambiguous. What you're asking for is multiple posts with identical identifiers, which raises the problem: we have 1 identifier, 4 posts, but which post do we use? –  Tom J Nowell Nov 16 '11 at 15:38
1  
My best reccomendation is to pull out a thesaurus, as it would be far easier and faster than trying to fix this ( why scale a mountain for an ice cream cone, when there's an ice cream tub on the seat next to you? ) –  Tom J Nowell Nov 16 '11 at 15:42

i'm no guru but i'll do my best here... generally speaking this issue you are describing appears when wordpress tries to create a new row in the wp-posts database table... if there's already a row there with the same slug it would automatically add a number to make the new row's slug unique. makes sense? in order to provide better help than that please let me know your exact permalink structure and provide examples for the URLs you've been having issues with. If your permalink structure is /%postname%/ you better change it to /%category%/%postname%/ i hope that helps!

share|improve this answer
    
i encountered the same problem when utilizing a multilanguage plugin (wpml) - is this the case here? are you using such a plugin? –  Talbatz Nov 16 '11 at 7:13
    
no i am not using multilanguage plugin...just having posts with same title that is all but posts are in entirely different categories so i want the title to remain the same without the numbers in front of them –  grant tailor Nov 16 '11 at 8:04
    
permalink is already /%category%/%postname% and the structure is like category1/category1_1/title1 and now when i get another post with title "title1 then what wordpress does is change it to category2/category2_2/title1-2 where wordpress added the "-2" because same title...i do not want that –  grant tailor Nov 16 '11 at 8:06

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.