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've been on a quest for the past couple of days reading up on Rewrite in WordPress but still can't seem to figure out how to accomplish this.

When using pretty links in WordPress, media attached to a page forms a URL like:


What I would like to do is create a permalink structure based on the order in which the images are attached to the page. For example:


where menu_order is the number in which the image is ordered.

From what I understand, the way permalinks work in WordPress is that it reads the URL and then translates that to its original query (in this case, index.php?attachment_id=ID). And then from there, it pulls whatever information needs to display.

Any suggestions as to how I could accomplish this? Links to posts that might guide me in what I need to do? Thanks in advance.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.