Adding Attachments to WordPress Comments (& Why You May Want To)

Posted on December 30, 2016 by in Tips & Tricks | 9 comments

Adding Attachments to WordPress Comments (& Why You May Want To)

Text is boring! We live in a multimedia world, so why are WordPress comments limited to just text? Adding attachments in WordPress comments opens up a realm of interesting new options for your comments section.

The idea of adding attachments to comments is far from new – Facebook allows it, bulletin boards allow it, so why can’t WordPress blogs allow it? In this post, I’ll show you exactly how to enable adding attachments to WordPress comments, as well as some important things to consider before you open the comment attachment floodgates.

Why Allow Attachments in WordPress Comments?

Let’s start with the less serious reason to consider adding comment attachments:

They’re just plain fun! Attachments allow readers to upload GIFs or images to go along with their comments. And in a world replete with memes, this can make your comments section a lot more fun and lively.

But it’s not just about fun, it also allows users to submit files to an individual post. When could this come in handy? I imagine it’s helpful in a variety of situations, but I’m picturing running a contest and asking users to attach a file to the post as a method of submission.

Another use case might be if you’re running an eCourse or using WordPress as an online complement to your real-world class. Opening comment attachments allows students to easily submit documents to the post containing your lesson.

So whether it’s for fun, practicality, education, or something else, there are definitely some reasons to consider adding attachments in WordPress comments.

Important Considerations Before Allowing Attachments

Do you know what would be a really bad idea? Allowing readers to attach any type of file they want with no size limits. Yeah, that’s how you get someone to upload a 5GB .zip file of cat pictures…or worse.

So, make sure you consider these two limits:

  • File size limits – you definitely need to set a maximum file size for attachments. The solution I’ll show you in the next section will make the default upload limit the limit set by your server. But that might be too high for most situations. If you’re just allowing image/GIF uploads, I think 2MB is a good maximum.
  • File type limits – think about the types of attachments you want to allow and then only add those. Keep your site as locked down as possible. If you only want images in your comments section, there’s no reason to allow users to upload .PPT files.

Okay, now that you know what to pay attention to, here’s how you can allow attachments in your WordPress comments section.

How to Add Attachments to WordPress Comments

While there is a premium plugin offering more full-featured comment attachments, I like to keep things free whenever possible.

To stay on the free side of things, you can use the Comment Attachment plugin. Get started by installing and activating the plugin like you would any other free plugin.

Once it’s activated, you can configure it by going to Settings → Discussion and scrolling to the Comment Attachment section:

Adding attachments in WordPress comments

Here are the settings you’ll absolutely want to configure:

  • Maximum file size (in megabytes) – this is the file size limit I discussed earlier. Make it as small as possible (like I said, under 2MB is probably a good starting point for images).
  • Is attachment required? – if you’re using attachments for a course, you might want to make attachments required in order to leave a comment. Otherwise, you probably should leave it disabled.
  • Attach attachment with current post? – this makes it easier to find attachments for individual posts in your media library.
  • Show image thumbnail & thumbnail size – choose whether or not you want to actually display images in your comments (or just links to the image files). If yes, you can also choose how large you want the image’s dimensions to be.
  • Try to embed audio/video player? – if you’re allowing video/audio attachments, you can have the plugin automatically make them playable using the native WordPress media player.
  • Allowed file types – finally, you want to configure all of the allowed file types. The plugin currently allows 32 different file types, divided by media type. Go through and check the types you’d like to allow.

adding-attachments-in-comments-wordpress-2

Once you’re finished configuring, make sure to save your changes.

How Comment Attachments Work

Once you’ve configured the plugin, your users will now be able to upload attachments to your posts like this:

Upload attachments

Because I configured the plugin to only display image thumbnails, any uploaded images will look like this:

display thumbnails

But remember, you can always make images display with larger dimensions if you’d like.

Where the Attached Files Are Stored

The plugin will store any files attached to comments in your normal WordPress media library:

WordPress media library

If you expand the details for any file, the plugin will tell you exactly which post the file was uploaded to:

uploaded to details

How to Delete a File Attached to a Comment

By default, the plugin makes it so that deleting a comment also deletes all attachments associated with that comment. So, unless you turn that default setting off, you simply need to delete a comment to delete its associated attachments.

During comment moderation, you also have the opportunity to delete the attachment from a comment without removing the whole comment. So, if someone attaches an inappropriate file to an otherwise acceptable comment, you don’t need to completely delete the comment:

deleting attachments

Finally, you can always delete attached files by going to your WordPress media library and deleting them there.

Wrapping Up

Enabling the adding of attachments to WordPress comments is pretty easy. Just remember to be careful. Keep a sensible file size limitation and only allow the exact file types you need.

If you’re only allowing attachments for a private site (e.g. a closed learning course), then you can probably afford to be a little more liberal with file size limits and attachment types.

But if you’re allowing attachments to a public comments section, definitely keep things locked down to keep your site secure and performing well.

Would you ever consider allowing attachments on your WordPress site? I’d love to hear why or not.

Article thumbnail image by drvector / shutterstock.com 

Premade Layouts

Check Out These Related Posts

Splice Video Editor: An Overview and Review

Splice Video Editor: An Overview and Review

Posted on May 7, 2019 by in Tips & Tricks

Video is a valuable form of content for social media. Unfortunately, creating quality videos is usually a long process that involves moving mobile footage to a desktop app for editing. However, mobile editing is on the rise. Apps such as Splice Video Editor make it possible to efficiently create...

View Full Post

9 Comments

  1. We rely fairly heavily on Akismet to filter out a lot of spam comments. My understanding is that most, or at least all the file attachment plugins I’m aware of, won’t cooperate with Akismet. Is that the case? Without the ability to efficiently filter spam, we could allow attachments although we’d love to for reader engagement.

    • I’ve had this plugin installed for months and Akismet works fine 🙂

  2. This is pretty cool. I have recipes on my site so can now allow visitors to post pics of how they got on making them.

  3. Hello Colin,

    We allow attachments on several sites on multiple WP 4.7 multisite networks.

    Hi Roger, we also use Akismet and run an army of plugins across various networks and have not encountered any conflicts with Akismet.

    We have also used the plugin Comment Attachment on some sites.

    I realize that all the following comment features will not be suitable for many scenarios and we only allow the features for registered, logged in users, but wanted to share that they work for us.

    We have tested a slew of comment related plugins and found the following to all work realiably on multiple WP 4.7 multisite networks.

    We use the plugin TinyMCE Visual Editor Comment with the media upload feature active to allow several post editor features on comments and we enable the media upload feature for photos and other attachments. This allows document uploads as well. (Note you may need to add additional file types to Upload Settings in Network Settings in order to allow document uploads.)

    https://wordpress.org/plugins/tinymce-visual-editor-comment/

    If you go as far as allowing this much comment editing power for users, then you may want to also activate oEmbed features in comments so they work like they do in the Post editor. We use the plugin oEmbed in Comments for that. It has not been updated in more than 2 years, but seems to work ok for us.

    https://wordpress.org/plugins-wp/oembed-in-comments/

    Once users can post comments, then some will inevitably need to edit their comment. We tried several comment editing plugins and had trouble with all of them except Simple Comment Editing, which has worked on all sites with a huge variety of other plugins active.

    https://wordpress.org/plugins/simple-comment-editing/

    At some point in time site admins will probably find it necessary to move one or more comments from one author to another for some reason and when you encounter than need, then Tako Movable Comments can do the job.

    https://github.com/renettarenula/Tako/

    All of these plugins run simultaneously and coexist without conflicts in our use cases.

    Based on the small number of installations for all these comment related plugins, it must mot be a very popular feature to allow these levels of user interaction in comments and/or perhaps more robust 3rd party comment solutions like Disqus are preferred.

  4. I don’t allow comments because of spam but I like the idea of the Divi plugin for adding testimonials. So I’m going to try that.

  5. What if you want to allow only ‘still’ image files – which would include normal GIFs but not animated GIFs?

    The screenshot showing selection of allowed types does not seem to make that distinction.

  6. Recently, I have transferred my site from sbi to WP. And really, I was looking for this from the last week. It helped me a lot. It was easy to understand. Thanks!

  7. I blog mostly about design and creative lifestyle, so this is perfect for me. I would like readers to be able to upload images of their creative projects. It’ll be interesting to see how this works out. Thanks!

Join To Download Today

Pin It on Pinterest