this may be a step too far but I publish occasional tutorials on my personal blog and sometimes in comments get asked questions where an image would be very helpful to include as the answer. I've done a plug-in search and also looked for code but come up with nothing. Is there any way I can allow those with Admin role to upload an image as part of their reply to a comment? I don't want to allow readers to upload images really. Also I'm not really looking to add a link to an image in the reply, I'd ideally like it in the comment reply itself. Just a 'too difficult' or 'can't be done' response would put me out of my misery :-)

  • Did you come across this plugin: wordpress.org/extend/plugins/comment-images You could just edit the code and set the currect_user to an admin capability for the upload.
    – Christine Cooper
    Commented Jan 21, 2013 at 16:06
  • Hi Christine, thank you I saw that plugin but didn't think about editing it I must admit. I think you could have the solution though. I'm not sure what files it includes but would it just be a case of surrounding some code somewhere with: <?php if (current_user_can( 'manage_options' )) { ...code from plug-in here... } ?> and this code would prevent the option to upload an image on my comments form from appearing unless a site admin were logged in?
    – Paul Brown
    Commented Jan 21, 2013 at 16:21
  • Yes indeed, it is a very simple process, please check the answer that I posted.
    – Christine Cooper
    Commented Jan 21, 2013 at 16:54

1 Answer 1


The easiest and quickest way that you can do this is by downloading the Comment Images plugin and limit access to the upload feature by the function current_user_can. As the WP page demonstrates, use:

if ( current_user_can('manage_options') ) {
 // Plugin code here

I had a very quick look at the plugin code and you may need to add this function to the add_image_upload_form function. All and all, this should only take you a few minutes to setup.

  • 1
    Hi Christine, I accepted the answer. I've added the plug-in and it does as expected. Haven't yet tried to edit the code and add the restriction as I have to race out but from your response that seems to make perfect sense to me. I'll have a play later.
    – Paul Brown
    Commented Jan 21, 2013 at 17:12
  • Good luck and let us know if it doesn't work out and we will assist.
    – Christine Cooper
    Commented Jan 21, 2013 at 17:30
  • 1
    Hi Christine, I added the edit to plugin.php at line 169 if ( current_user_can('manage_options') ) { and then to close it at line 182 } and as far as I can see it works as expected. The image I already added by way of reply shows to all but the option to upload images only shows to me. I have tested new comments both logged in (as admin) and logged out (posting as guest) to test and all appears fine to me.
    – Paul Brown
    Commented Jan 21, 2013 at 22:36
  • Glad to hear it Paul and good luck with your site.
    – Christine Cooper
    Commented Jan 22, 2013 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.