'how to find the code that prevent wordpress text selection?
I know this may be stupid and simple question but I really need help there,s a wordpress website that have been created by someone and there is a text copy protection that I have no Idea how he applied to the website . I checked wordpress plugins and even tried additional css code but none of them disable that text copy protection . How can I find the code or the thing that prevent text copy protection ? thank u so much website address : https://www.lanamind.com/
Solution 1:[1]
I have added two options and both are working for me.
- If you want to achieve this using plugin All in one security plugin provide this option where you can add copy protection. Plugin will always be the better option for this feature and this plugin has many other settings to secure your site.
Take a look here:
- If you don't want to use this plugin you can add this code in your PHP file. I have tested it and it is working.
function output_copy_protection_code() {
?>
<meta http-equiv="imagetoolbar" content="no"><!-- disable image toolbar (if any) -->
<script type="text/javascript">
/*<![CDATA[*/
document.oncontextmenu = function() {
return false;
};
document.onselectstart = function() {
console.log("here");
if (event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password") {
return false;
}
else {
return true;
}
};
if (window.sidebar) {
document.onmousedown = function(e) {
var obj = e.target;
if (obj.tagName.toUpperCase() == 'SELECT'
|| obj.tagName.toUpperCase() == "INPUT"
|| obj.tagName.toUpperCase() == "TEXTAREA"
|| obj.tagName.toUpperCase() == "PASSWORD") {
return true;
}
else {
return false;
}
};
}
document.ondragstart = function() {
return false;
};
/*]]>*/
</script>
<?php
}
add_action('init', 'output_copy_protection_code');
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

