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.

Why isit that WordPress sometimes add a number to my slug even if I explicitly set it. Like if I set slug to be 'about' I get 'about-2'. I want the slug to be correct so I can style using CSS easily. Or is there a better way?

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

WordPress appends a number to your slug when the database already contains a duplicate slug. It will append the number even if the duplicate post or page has been moved to the trash.

The URL Routing system is one of the weaknesses of WordPress. Mike Schinkel made a very good proposal to evolve the re write engine on trac but the ticket was closed as "wont fix"

share|improve this answer
    
Thanks, I forgot the trash ... emptied it and it works. I knew it was something to do with duplication, but I dont see a page with that slug ... just forgot trash ... thanks –  JM at Work Apr 5 '11 at 1:26
add comment

When WordPress appends numbers to the slug it usually means that you allready have a page or post with that slug.

But if you can style based on the slug you can always style based on the page or post ID.

share|improve this answer
    
But post id may change if I migrate the theme for use in another server –  JM at Work Apr 5 '11 at 1:24
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.