Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a problem with images.

I can see my uploaded images, as previously, through the media library. I can access each image by clicking on "edit". But if I then click on "View Attachment Page", I am taken to the "404! We couldn't find the page!" message. This applies to all images in the library.

At the same, images in some posts (but not all) are behaving differently from before. It used to be possible for readers to click them and see them full size, whereas now that click simply relads the posts in question.

I have experimented with deactivating plugins, but have not found a solution for this. Does anyone know what might cause this, and what might have triggered it?

share|improve this question
    
Can we see a live link to the issue? –  Chip Bennett Jan 30 '13 at 16:27
3  
What changes have you made to your install between when things were working and when they stopped working? –  Dan Jan 30 '13 at 16:33

2 Answers 2

From what you've described, it sounds like the theme doesn't have an attachment.php template to handling displaying the actual attachment page.

You check on the attachment page, by going to Appearance->Editor, and checking for an attachment.php; however, I believe that answer is incorrect. WordPress should default to displaying the image on the normal blog index page, if I'm not mistaken. Which means the error could have something to do with a custom permalink structure.

Have you changed the permalink structure? If so, try changing it back to default and see if you still get a 404.

share|improve this answer
    
Oh. Where do I check that? –  H Hall Jan 30 '13 at 17:14
    
I did not knowingly make any structural changes before this began to occur. I had recently posted, and upgraded to the new WP release (but I am told the image started playing up before that). I use a custom URL structure, but have not changed that for many months. I have also checked the indexing settings on the Yoast plugin lately, but without making any changes. Incidentally, the blog is at www.petersommmer.com/blog (but most of the images have been fixed by now). –  H Hall Jan 30 '13 at 19:03

Your theme will require either a catch all 'attachment.php' template or specific template for the attachment type, ie 'image.php'

here's a very simple one:

image.php

<?php 
get_header();
while ( have_posts() ) : the_post();
the_title( '<h1 class="entry-title">', '</h1>' );
the_content();
endwhile;
get_footer();
?>
share|improve this answer
    
No, this is not necessary. Everything defaults to index.php if no other templates are available in the template hierarchy. –  Pieter Goosen Jun 4 at 5:49

Your Answer

 
discard

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.