How do I disable right-click on images?

Posted by on March 3, 2012 at 3:23 pm.

Earlier today, I posted ways you could get around people stealing your images. That post was focused on code that could be added to prevent users pinning your images to Pinterest.

Users that don’t want to mess around with their themes, can always install the NoPin WordPress Plugin created by Shawn Hooper. It can also be found on the WordPress Addon site; NoPin WordPress Plugin.

Interestingly enough, the script that Pinterest provided doesn’t seem to work with all WordPress themes. With some of the themes, I was still able to copy to Pinterest without an issues. A bit of research, and it seems that it might not work in some themes.

So… how are you going to keep people from copying your images? One workaround is disabling right click on your images. For a free dhtml script, I used the disable right click on images code, that’s located at Dynamic Drive.

How do I disable right click on my WordPress site?

  1. Click on Appearance tab
  2. Click on Editor
  3. Click on Footer (footer.php)
  4. Insert the code, listed below, on the line right above the </body> tag
<script language="JavaScript1.2">
Disable right click script II (on images)- By
For full source, Terms of service, and
100s DTHML scripts
var clickmessage="Right click disabled on images!"
function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
return false;
else if (document.layers) {
if (e.which == 3) {
return false;
else if (document.getElementById){
if (e.which==3&&"IMG"){
return false
function associateimages(){
if (document.all)
else if (document.getElementById)
else if (document.layers)

For those that don’t want to install the above code, you can always pick up a wordpress addon that disables right clicking images; no right click plugin.

I’ve checked out both the code, and the plin in. Thus far, both have worked with various themes (10 thus far) that I’ve tried.

Because right click has been disabled, most users who use sites such as Pinterest, won’t be able to right click your image and pin on their board. It won’t stop all the copying, but it will decrease the amount that’s copied without permission. As mentioned in the post, how to disable our images from being pinned to Pinterest, a technically advanced user will still be able to copy your images.





  • Cris says:

    Just as an FYI, your images can still be stolen with a simple screen print and pasting into any image editing software. The best you can do is to disable (if you want to go that far) and make sure you watermark your images over important elements/lines so that it cannot be cropped out without chopping off a good part of the image.
    Cris recently posted..Year of Projects: Week 36


    Opal Reply:

    Hi @Cris,
    You’re right. It can also be done in an offline blog editor. However, disabling right click will deter your casual users, so it’s another option for those who might be annoyed by seeing their images all over the place.

    I agree the ultimate is to place a watermark over areas so cropping isn’t an issue. However I have seen people bold enough to still snag those items also.

    Thanks for stopping by, I enjoy your site.
    Opal recently posted..Pinterest: Can WordPress users prevent their images from being pinned to Pinterest?


  • It can also be done by those of us who understand how to use Firefox; I’m just saying. lol Not that I ever steal images (imagine angel halo). lol
    Mitch Mitchell recently posted..What Could You Do In 36 Hours?


    Opal Reply:

    @Mitch Mitchell, LOL, Hey quit giving folks ideas! however you’re right, if you know what you’re doing you can get around it with a few browser applications.

    Reading over the post, I realize I forgot to add the line at the bottom that states it won’t stop it all. I did that with my pinterest post. I’ll have to make that correction.

    I remember my father asking me, Hey Opal I can’t copy this page, can you do it for me? My reply, I could, but I won’t. The site obviously doesn’t want their information copied, so just read what’s there. That’s how he became aware of intellectual property online.
    Opal recently posted..Pinterest: Can WordPress users prevent their images from being pinned to Pinterest?


  • Leah says:

    I used to utilize wp-protect plugin in my blogs. This disable right-click on images, contents, etc. It is really frustrating when someone stole your images that you bought for dollars.

    By the way, this tutorial is very helpful. This is an additional info for me to apply for my blogs…
    Leah recently posted..Omnitrition


    Opal Reply:

    Hi @Leah, I agree, it can be frustrating, while it won’t stop someone that is internet savvy from acquiring your images, the above methods can prevent your casual internet user.

    Before I use images, I always check on the copyright policy. I’ve gotten into the habit of linking to the original photo also.
    Opal recently posted..Social studies; last big project is done


Trackbacks / Pingbacks

CommentLuv badge