Certainly! Here’s a concise and SEO-friendly blog post on How to Prevent Text Selection and Copy/Paste in WordPress without using a plugin:
As a website owner, protecting your content from unauthorized copying is crucial. Whether it’s automated content scraping or manual copying, preventing text selection and copy/paste can help safeguard your valuable content. In this article, we’ll explore two methods to achieve this without relying on plugins.
Prevent Text Selection and Copy/Paste in WordPress
Method 1: Preventing Text Selection Using CSS
1. Access the WordPress Customizer:
- Log in to your WordPress dashboard.
- Navigate to Appearance » Customize.
2. Add Custom CSS:
- Click on the Additional CSS tab in the left column.
- Paste the following CSS code into the provided box:
CODE 1 :
* { -webkit-touch-callout: none; /* iOS Safari */ -webkit-user-select: none; /* Safari */ -khtml-user-select: none; /* Konqueror HTML */ -moz-user-select: none; /* Old versions of Firefox */ -ms-user-select: none; /* Internet Explorer/Edge */ user-select: none; /* Non-prefixed version, supported by Chrome, Opera, and Firefox */ }
CODE 2 :
body { -webkit-user-select: none !important; -moz-user-select: -moz-none !important; -ms-user-select: none !important; user-select: none !important; }
EXCLUDE CERTAIN AREAS LIKE CODE BOXES, QUOTE BOXES :
.post blockquote,.wp-block-code code { -webkit-user-select: text !important; -moz-user-select: text !important; -ms-user-select: text !important; user-select: text !important; }
Test It Out:
Try selecting text on your live website. You’ll find that it’s no longer selectable. Remember that tech-savvy users can still view the source code or use the Inspect tool to access your content. Additionally, this method won’t stop auto-blogging tools that fetch content via RSS. However, it adds an extra layer of protection.
Method 2: Preventing Text Selection Using a Plugin (Optional)
While we recommend the CSS method for simplicity, some users prefer plugins. If you choose this route, search for a reputable plugin that offers text selection prevention features.
Is It a Good Idea to Prevent Text Selection?
Balancing content protection and user experience is essential. While preventing text selection can deter casual copying, it won’t stop determined individuals. Consider your audience and the nature of your content before implementing these measures.
Remember, no method is foolproof, but taking steps to protect your content is worthwhile. By following these steps, you can enhance content security on your WordPress site. Happy blogging! 🚀