• I’ve read a bunch of threads about this issue, where people can still leave comments on an attachment when the post it’s attached to has comments disabled.

    First, can anyone confirm this is still a problem in 3.2.1? I’ve had mixed results, but not sure if it’s just the way I have my template set up.

    Second, is the following code in attachment.php an acceptable solution, and won’t cause SEO issues?

    <?php wp_redirect(($post->post_parent) ? get_permalink($post->post_parent) : home_url() ); ?>

Viewing 1 replies (of 1 total)
  • Thread Starter jmh

    (@jmh)

    I guess “issue” is the wrong word, just unexpected behaviour, and after testing further, it seems if an attachment is unattached, or attached to a post that has comments enabled, you can post comments on them.

    For anyone else looking for an answer, I’ve seen both the wp_redirect method i posted above used, and I also went with the code below on a site today, assuming you have no image or attachment template, and attachments are being processed by the index, or main loop, just replace the regular

    <?php comments_template(); ?>

    with

    <?php if (!is_attachment()) : comments_template(); endif; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Image Attachments and Comments’ is closed to new replies.