WordPress.org

Ready to get started?Download WordPress

Forums

Post URL Opening Unattached Image Content (1 post)

  1. SEO Dave
    Member
    Posted 1 year ago #

    Bought a site recently, added the WordPress export file into a WordPress Domain Mapped Install running WP 3.4 (not updated, have an issue with a Child Theme settings being reset after updating to 3.5 and don't have the time to edit all the mapped sites right now). Although I use the Domain Mapping Plugin I'm not posting it under the plugin as have no reason to suspect it's the plugin.

    Since it's a new addition to my network not sure when the problem started. Had it a few weeks at least and Google indexing is messed up, the attachment URL (.com/?attachment_id=208) is indexed instead of the post URL so guess it's been at least as long as I've owned the site.

    I fixed the issue, but would like to know why it occurred as I don't think it should happen.

    A site of around 60 posts had about a dozen posts loading the attachment instead of the post content using the attachment template.

    Example was a post with post id 207, post_type = post (checked the wp_posts table) was loading the post id 208, post_type = attachment using the attachment template (attachment.php). The theme I use links to the post/attachment URL and the link was showing the attachment format for those links (.com/?attachment_id=208), so the URL to the post was loading the attachment.

    On the categories where the posts are linked it was showing an excerpt from the correct posts, but loaded the attachment content, so only figured there was an issue when I loaded a post and found the attachment loaded instead of the post.

    Under Media most of the images were unattached, I've got plenty of sites with unattached images so at first didn't think it would be the cause. I attached the images to their relevant posts and now the correct content loads etc...

    What might cause an unattached image to load instead of the post?

    Like I said I've fixed the problem, but had to check all 60 posts and attach about 20 images, still have around 40 images unattached. The only thing that's of interest with the problem images I attached is the name of the attachments matched the posts, so where a post was called "This Is My Post" the attachment was listed as "This Is My Post" under Media. So it might be the slugs used for the post and file are the same.

    Before figuring out the above I did check my .htaccess file, I run WPSupercache and the rules matched those on the settings page.

    Going to have to go check my other sites I recently added.

    David

Topic Closed

This topic has been closed to new replies.

About this Topic