Disabling the right-click menu stops casual visitors from saving images or copying text with a click. It takes a few lines of code – but be clear about what it does and doesn’t do before you add it.
A deterrent, not protection
Anyone can still view the page source, use keyboard shortcuts, take a screenshot or switch JavaScript off. It also annoys legitimate visitors who use the menu to open links in a new tab. For images that matter, use watermarks or lower-resolution web versions.
Where to put the code
Don’t edit your theme’s functions.php directly – updates overwrite it, and many servers (including this one) disable the theme editor for security. Use a child theme or a tiny site-specific plugin:
wp-content/plugins/disable-right-click/disable-right-click.phpu003c?phpn/**n * Plugin Name: Disable Right-Clickn * Description: Blocks the context menu on the front end (not in wp-admin).n */nnadd_action( 'wp_footer', function () {n if ( is_user_logged_in() ) {n return; // Editors keep their right-click.n }n ?u003en u003cscriptu003en document.addEventListener( 'contextmenu', function ( e ) {n if ( ! e.target.closest( 'input, textarea' ) ) {n e.preventDefault();n }n } );n u003c/scriptu003en u003c?phpn} );- Create the folder and file above (via SFTP or your host’s file manager).
- In WordPress go to Plugins and activate Disable Right-Click.
- Log out (or use a private window) and right-click the site to test.
The snippet skips logged-in users and still allows right-click inside form fields, so people can paste into your contact form.

