Recently, one of our readers asked us how they can prevent text selection and copy/paste in WordPress?
Many publishers who want to stop people from stealing their content may want to apply this. This basically just makes it a bit harder for people to copy text from your website.
In this article, we’ll show you how to easily prevent text selection and copy/paste in WordPress.
Why Prevent Text Selection and Copy/Paste on Your WordPress Site?
Many bloggers find that their content gets stolen and used without permission.
This can happen through automated content scraping. It can also happen if someone manually copies part or all of your content.
One way to make this more difficult is to prevent people from copying and pasting your text. You can do this by making it harder for them to select the text on your website.
Remember, tech savvy users can still view the source code or use the Inspect tool to copy anything they want. These techniques will also not stop people who are using auto-blogging tools to fetch the content using RSS.
Keeping this in mind, let’s take a look at a few different ways to prevent text selection and copying in WordPress.
Method #1: Preventing Text Selection Using CSS
This method is simpler, and you’ll just need to add some custom CSS code to your WordPress theme. If you haven’t done this before, then take a look at our guide on adding custom CSS to your site before you begin.
First, you need to visit the Appearance » Customize page in WordPress admin area to launch the theme customizer.
In theme customizer, you need to click on the ‘Additional CSS’ tab from the left column.
Now, you will see a box to add custom CSS to your WordPress theme. Simply copy and paste the following CSS code into that box.
-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, currently supported by Chrome, Opera and Firefox */
This is how the code will look when added.
Now, go ahead and try to select some of the text on your page in the live customizer. You will find that you cannot select it.
Don’t forget to click the ‘Publish’ button at the top of the screen to put your changes live for everyone.
Note: This method only allows you to add custom CSS for the currently active theme. If you change your theme, the custom CSS will not be saved. For your code to be saved regardless of which WordPress theme you’re using, we recommend using the WPCode plugin.
Method #2: Preventing Text Selection Using a Plugin
For this method, we will be using a WordPress plugin that disables text selection and right-click. This would also protect images from being downloaded and reused.
Upon activation, the plugin will work straight out of the box. Users will no longer be able to copy and paste text from your site. They also will not be able to right click or print your content.
If you want to change the plugin’s settings, it’s easy to do so. Simply go to the ‘Copy Protection’ page in your WordPress admin.
Here, you can choose to enable or disable protection for specific types of content.
Make sure you click the ‘Save Settings’ button after making any changes.
You can also change the message that will appear if someone tries to print your content. The message will display like this in the print preview and on the printout itself.
Is it a Good Idea to Prevent Text Selection in WordPress?
While many new website owners want to stop people from copy/pasting content from their site, these techniques do not really prevent content theft.
Any slightly tech savvy user can easily open your website code source to copy any content that they want.
Also, not everyone copying your text will be a content thief. For instance, some people may want to copy the title to share your post on social media.
This is why it’s not best practice to prevent text selection. We recommend you only use this method if you feel it’s truly needed for your site.
In most cases, it’s better to look for an alternative way to prevent content theft. If a site is re-publishing your content without permission, then you could find out who is hosting the website and send a DMCA takedown notice.
We hope this article helped you learn how to prevent text selection and copy/paste in WordPress. You might also want to see our guide on how to create a membership site with protected content, and our comparison of the best email marketing services for subscriber only content.