How To Disable Right Click On Website?

You are currently viewing How To Disable Right Click On Website?

In today’s digital age, protecting your website’s content is crucial. One of the easiest ways to do so is by disabling the right-click function on your website. This will prevent visitors from easily copying your text and images, thereby safeguarding your intellectual property.

Add this code in functions.php in wordpress.

/*Disable right click */
function disable_right_click() {
        return false;
add_action('wp_footer', 'disable_right_click');

/*code ends */

Add Custom Css

body {
	-moz-user-select: none;
	-khtml-user-select: none;
	-webkit-user-select: none;
	user-select: none; 
/*CSS ends */

/*css to remove image load option in mobile */

img {
	pointer-events: none;

/*CSS ends */

While disabling right-click can be an effective way to protect your content, it’s important to note that it can also have some drawbacks. For example, it can limit accessibility for users with disabilities who rely on right-click functions, and it can also frustrate visitors who are used to using right-click for legitimate purposes.

Therefore, it’s important to use this feature judiciously and only when it’s necessary to protect your content. By following the steps outlined in this article, you’ll be able to disable right-click on your website and safeguard your content.

Muhammad Waqar

I started to help bloggers and content creators. They teach you the ins and outs of digital marketing so that you can make money from your blog or content creation without any struggle at all!