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 -

1 Answer 1


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.


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.