Home › Forums › Support › How to disable right click in wordpress without any plugin This topic has 6 replies, 2 voices, and was last updated 3 years, 9 months ago by David. Viewing 7 posts - 1 through 7 (of 7 total) Author Posts June 13, 2020 at 5:33 am #1326149 Carlos Hello there, I need to add code for to disable right click on WordPress without any plugin, add any codes but not working and broken the site. I don’t want other plugin, have 21 plugins and I’m wish delete plugins 1 to 1 but need options. Thank you very much! June 13, 2020 at 9:11 am #1326517 DavidStaff Customer Support Hi there, this article provides the one line of JS you require and some very good reasons why you shouldn’t: https://stackoverflow.com/a/737043 June 17, 2020 at 9:58 pm #1332087 Carlos Hello David, where I should add this code? document.addEventListener('contextmenu', event => event.preventDefault()); In my functions? I’m using the child theme. Thank you very much June 18, 2020 at 2:06 am #1332294 DavidStaff Customer Support Simplest way. Create a new Hook Element: https://docs.generatepress.com/article/hooks-element-overview/ Add the script like so: <script> // Code goes here </script> Select the WP_Footer hook. And set the Display Rules to Entire Site. June 26, 2020 at 3:16 pm #1343121 Carlos Hello David, the code is not working. Your code only disable the right click but not the copy and paste. Please I need your help. Thank you very much! June 26, 2020 at 3:42 pm #1343132 Carlos Hello there! This code here working like charm ! <body oncontextmenu="return false" onselectstart="return false" onkeydown="if ((arguments[0] || window.event).ctrlKey) return false"></body> Thank you very much! June 27, 2020 at 12:25 am #1343334 DavidStaff Customer Support Glad to hear that Author Posts Viewing 7 posts - 1 through 7 (of 7 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In