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 have a small WordPress install that I'm setting up, and have run into an issue that I've encountered before, but do not understand the cause.

Issue: With permalinks set to /%postname%/, on a site with the following:

  1. Home page
  2. About page (slug: "about")
  3. Two links to categories (there are two categories, with slugs of "digital" and "broadcast")
  4. About 35 posts

Most everything works as expected, however there is one post with a slug of "swampism" which displays (incorrectly) in the page.php template file, rather than the single.php template file (where all other posts properly display).

How does this happen? Why does it happen? And how can I fix it and/or avoid it in the future.

Note: Changing the permalink structure to default, or date driven is not an option. Besides, that is (in my mind) a work-around, not a solution/explanation of the problem.

share|improve this question
    
To anyone who wants to see the site, it's in development here: whoosh.acgdemo.com –  cale_b Dec 21 '12 at 22:34
add comment

1 Answer 1

up vote 2 down vote accepted

I was going to make this a comment but it was getting long and I think I see an answer emerging. I'll gamble.

If this is the problem URL: http://whoosh.acgdemo.com/swampism/, you are seeing an attachment page <link rel='canonical' href='http://whoosh.acgdemo.com/?attachment_id=114' /> WordPress shows these when individual images are requested. I am starting with that assumption.

The image on that attachement page is, interestingly, named Swampism.jpg which, if the pattern I see in my DB holds, means it has the slug of 'swampism'. I am betting that that is where you conflict is. WordPress is finding the image slug and loading the attachment page for it instead of finding your "page-name" slug.

share|improve this answer
    
Interesting. I'll do some testing, it at least gives me something to look at. I'll let you know if it proves to be true. –  cale_b Dec 21 '12 at 22:58
    
That seems to be it. As it turns out, we have several others with the same situation. Interesting that WP creates a slug from the filename. Would not have suspected that! –  cale_b Dec 21 '12 at 23:25
    
I would have expected some kind of prefix to the slug to avoid these kind of collisions. –  s_ha_dum Dec 21 '12 at 23:28
    
+1+ this one was like a CSI episode! –  brasofilo Dec 22 '12 at 12:54
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.