While disabling right-click functionality on informational websites can frustrate users who rely on browser features (such as opening links in background tabs), photographers, illustrators, and portfolio owners frequently request anti-leech protection to discourage casual image saving.

While determined scrapers can always inspect source files or browser developer tools, adding client-side protection deters casual image copying and establishes a clear intent that unauthorized downloading is prohibited.

There are two primary ways to disable right-clicking on a webpage:

  1. Embedding a lightweight JavaScript snippet;
  2. Installing dedicated WordPress security plugins.

1. Disabling Right-Click via JavaScript Snippet

You can disable the right-click context menu by attaching an event listener to the contextmenu event. Using jQuery:

<script type="text/javascript">
  jQuery(document).ready(function () {
    jQuery("body").on("contextmenu", function (e) {
      return false;
    });
  });
</script>

Or using modern vanilla JavaScript without external dependencies:

<script type="text/javascript">
  document.addEventListener('contextmenu', function (event) {
    event.preventDefault();
  });
</script>

In a WordPress theme, this code can be placed inside your child theme’s footer.php or injected via a code management plugin, ensuring it does not block initial page rendering.

2. Dedicated WordPress Plugins

If you prefer a configurable solution that survives theme updates without direct code edits, consider these plugins:

  • No Right Click Images Plugin: Targets <img> elements specifically without breaking right-click functionality on standard text links.
  • WP Content Copy Protection & No Right Click: Provides comprehensive protection against text selection, keyboard shortcuts (Ctrl+C, Ctrl+U), and image drag-and-drop.
✦ Independent Journalism · Reader Support ✦

Support Independent Perspectives & In-Depth Insights

Every thoughtful analysis and candid critique comes from our dedication to truth and quality. We choose not to follow sensational algorithms or clickbait headlines.

Sustaining independent research requires reader support. Make a one-time or monthly contribution, securely processed by Google.

Payments secured by Google · Manage or cancel anytime in your Google Account