WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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 create a custom permalink structure. I'd like to have a custom page which displays each post's image attachments, using the following structure:


If anyone visited this URL, it would serve up a page of images that are attached to hello-world. It's kind of like having a subpage I guess, but I'd want it for posts (not pages) and I'd want it to be automatic.

I have a template .php coded-up for this purpose; it will grab all attached images and display them. I'm just looking for a way that people can get to it via the above URL structure.

I'm not sure how to go about doing this ie. if there's an easy way in Wordpress, or if I need to look into Rewrite rules in my .htaccess. Any thoughts would be appreciated, thanks -

share|improve this question
up vote 0 down vote accepted

You could achieve that by adding a rewrite endpoint via add_rewrite_endpoint.

This post from a WordPress developer has a good explanation of how they work.

share|improve this answer
Ah - exactly what I was looking for! Thanks – wes Oct 2 '12 at 19:35

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.