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 know it isn't good practice but I'm considering using same name slugs for some pages and categories on a site that I'm working on. It's a small site and it doesn't seem to affect anything in particular. I added one slug and page with the same name and they worked fine, but when creating a second WP forced me to rename the page (being created after the category) with an additional "-2" being added to the slug. Is there a particular order to create the pages and categories in order to avoid this? I've created similar structures before without this appearing. Also checked trash for old pages that might be using the original slug.

share|improve this question
add comment

3 Answers 3

up vote 0 down vote accepted

I used to do the same thing - create a page with the same name as a category to use as a faux index page.

I think I used this No Category Base plugin to remove the /category/ bit from the URL. (I think it was this plugin.)

[...] this plugin will completely remove the mandatory 'Category Base' from your category permalinks ( e.g. myblog.com/category/my-category/ to myblog.com/my-category/ ).

share|improve this answer
    
Thanks, that did it! I'm back on using WPs traditional setup now with no faux Pages retrieving the posts, then using the plugin you suggested to clean up the URLs. –  Staffan Estberg Nov 1 '11 at 20:22
add comment

There is no way you can avoid this. In WordPress you cannot have two pages/categories with the exact same slug.

share|improve this answer
    
But right now I have a page called "Press" AND a category called "Press", and it's working as far as I know. The page runs a query that fetches the posts from the category (this was the only solution I could find in order to get rid of the ever-annoying "category" extra slug that gets added when using the regular archive / category for presenting the posts. –  Staffan Estberg Nov 1 '11 at 9:40
    
well if you have it working, then what is all the fuzz about? but evenso, you really should avoid using same slugs as in the future you might run into trouble, for example with other plugins or whatnot. Try to alter them as per @Brad Dalton's suggestion –  Piet Nov 1 '11 at 11:56
    
I got "Press" Page and "Press" category to co-exist, but not "News" Page/Category. Anyway, I removed the Page placeholders now trying to use WP as it is intended. –  Staffan Estberg Nov 1 '11 at 20:17
add comment

Make them slightly different as there's no way to avoid using the same slugs

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.