Last active
July 20, 2021 21:10
-
-
Save jmarreros/2b02de8a18e52d941119fadc3c2fc0d5 to your computer and use it in GitHub Desktop.
Evita el copiar pegar, la selección de texto y el menú contextual en una página específica de WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // No copiar este línea | |
add_action('wp_footer', 'dcms_avoid_copy_paste'); | |
function dcms_avoid_copy_paste() { | |
if ( is_page('politica-privacidad') ): | |
?> | |
<script> | |
(function( $ ) { | |
// Evitar copiar pegar y menu contextual | |
$('body').bind('copy contextmenu',function(e) { | |
e.preventDefault(); return false; | |
}); | |
// Evitar selección | |
$(document).ready(function(){ | |
$("body").css("-webkit-user-select","none"); | |
$("body").css("-moz-user-select","none"); | |
$("body").css("-ms-user-select","none"); | |
$("body").css("-o-user-select","none"); | |
$("body").css("user-select","none"); | |
}); | |
})( jQuery ); | |
</script> | |
<?php | |
endif; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment