WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to change the permalinks to my attachments in the same way as this question, and the given solution works great except for one problem: if the permalinks settings on my site contain %category%, the solution doesn't work at all and I get a "This page isn't redirecting properly" error. The only way I can get this solution to work properly is by using the provided "Day and Name", "Month and Name", and "Numeric" permalink settings.

What do I add to the solution so that still use %category% in my custom permalink settings?

share|improve this question
up vote 1 down vote accepted

It seems like what I want is something that WordPress's internal permalink code isn't prepared to deal with. After reading this writeup by Otto, I've come to understand that having my permalinks start with %category% could create a performance issue down the road and I would have to create a function that further alters the WordPress permalink rules in order to get the attachment permalinks working with %category%.

As a result, I've decided to start all my posts with the year. This allows me to use the solution found here for attachment permalinks, and I'll avoid performance headaches in the future.

share|improve this answer

Your Answer


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.