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?

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.