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

When I click on post images it redirects in a page with a url like this: http://localhost/?attachment_id=897. Can I set the default image link like http://localhost/wp-content/uploads/2012/05/dice.jpg instead of http://localhost/?attachment_id=818? Also how to style the attachments page? Should I have a page like attachments.php?

share|improve this question
up vote 0 down vote accepted

Navigate to: Dashboard -> Settings -> Media

Check this box: Organize my uploads into month- and year-based folders.

Save changes.


Navigate to: Dashboard -> Settings -> Permalinks

Select "Post name" under "Common Settings"

Save changes.

As far as styling an attachment page, you can either open up your page template file, and add a conditional check for is_attachment() or you can make an attachment.php file in your template directory. Read more about the template hierarchy for attachment display.


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.