skip to Main Content

How to Disable Copy Paste in WordPress (Step by Step Guide)

On many websites, you might have noticed that the content cannot be copied or selected. Even when you right-click, options like copy, cut, or paste do not appear. In this tutorial, we will learn how to disable copy paste in WordPress easily without using any plugin.

Let’s get started.

Step 1: Login to Your WordPress Admin Panel

First, log in to your WordPress dashboard with your admin credentials.

Step 2: Go to Theme File Editor

From the left sidebar, click on Appearance → Theme File Editor.

How to Disable Copy Paste in WordPress (No Plugin Needed)

Step 3: Open the functions.php File

On the right sidebar, click on the functions.php file of your active theme.

How to Disable Copy Paste in WordPress (No Plugin Needed)

Step 4: Add the Code

Scroll to the very bottom of the file and paste the following code. Finally, click on Update File.

/**
 * Disable Right Click, Copy, Cut & Paste on Frontend
 */
function nahian_disable_copy_paste() {
?>
<script>
document.addEventListener("DOMContentLoaded", function() {
    // Blocked events list
    ["contextmenu", "copy", "cut", "paste"].forEach(function(evt) {
        document.addEventListener(evt, function(e) {
            e.preventDefault();
        });
    });
});
</script>
<?php
}
// Hook into wp_head so that script loads on every frontend page
add_action( 'wp_head', 'nahian_disable_copy_paste');

How to Disable Copy Paste in WordPress (No Plugin Needed)

Step 5: Done!

That’s it. Now, no one will be able to copy or right-click on your website content.

Important Note

Before making any changes, it is always recommended to take a backup of your theme to avoid unwanted issues.

✅ With this simple method, you have successfully learned how to disable copy paste in WordPress and protect your valuable content from being copied.

 

Latest Articles
September 15, 2025

How to Add Profile Picture in Webmail Using Gravatar

Having a professional email address is important, but adding a profile picture makes it even more personal and trustworthy. In…

August 23, 2025

How to Disable Copy Paste in WordPress (Step by Step Guide)

On many websites, you might have noticed that the content cannot be copied or selected. Even when you right-click, options…

August 22, 2025

🚀 How to Fix “Unknown collation: ‘utf8mb4_0900_ai_ci’” in cPanel

If you use MySQL or MariaDB, you might have encountered the following error: Unknown collation: 'utf8mb4_0900_ai_ci' 🔎 Why This Happens…

Subscribe To Our Newsletter

Don't get left out of the loop, make sure you subscribe to our newsletter below so you can be notified of our latest insights, tips, tutorials, sales and more!

Discussion
Back To Top