Title: Copy code button not working
Last modified: June 25, 2025

---

# Copy code button not working

 *  [aakashmittalwp578](https://wordpress.org/support/users/aakashmittalwp578/)
 * (@aakashmittalwp578)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/copy-code-button-not-working/)
 * When I update the plugin to latest version then Copy button not working and showing
   error in console
 * ![](https://wordpress.org/f333f2cd-ab2d-49b5-a531-72f305bae4b7)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [urvanov](https://wordpress.org/support/users/urvanov/)
 * (@urvanov)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/copy-code-button-not-working/#post-18527825)
 * Hi, [@aakashmittalwp578](https://wordpress.org/support/users/aakashmittalwp578/).
   Thank you for writing.
 * Please attach the text with error message from the console.
 *  Thread Starter [aakashmittalwp578](https://wordpress.org/support/users/aakashmittalwp578/)
 * (@aakashmittalwp578)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/copy-code-button-not-working/#post-18527846)
 * I am receiving this error in console
 * urvanov_syntax_highlighter.min.js?ver=2.8.40:1 Uncaught TypeError: Cannot read
   properties of undefined (reading ‘writeText’)
   at J.copyPlain (urvanov_syntax_highlighter.
   min.js?ver=2.8.40:1:13921)at HTMLDivElement. (urvanov_syntax_highlighter.min.
   js?ver=2.8.40:1:8549)at HTMLDivElement.dispatch (jquery.min.js?ver=3.7.1:2:40035)
   at v.handle (jquery.min.js?ver=3.7.1:2:38006)
 * J.copyPlain = function(ak, al) {
   if (typeof B[ak] == “undefined”) {return aa(
   ak)}var aj = B[ak].plain;var ai = aj[0].value;navigator.clipboard.writeText(ai).
   then(function(am) {return I(ak, H.copy)});return false}
 * In this code
 *     ```wp-block-code
       base.copyPlain = function (uid, hover) {if (typeof urvanov_syntax_highlighters[uid] == 'undefined') {return makeUID(uid);}var plain = urvanov_syntax_highlighters[uid].plain;var plainTextCode = plain[0].value;navigator.clipboard.writeText(plainTextCode).then(function(value) {return urvanovSyntaxHighlighterInfo(uid, strings.copy);});return false;};
       ```
   
 * ![](https://wordpress.org/391d2ac9-1cda-4be6-b99f-4e7edcc58dc1)
 *  Plugin Author [urvanov](https://wordpress.org/support/users/urvanov/)
 * (@urvanov)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/copy-code-button-not-working/#post-18527858)
 * Looks like navigator.clipboard is undefined.
 * I checked it in MDN [https://developer.mozilla.org/en-US/docs/Web/API/Clipboard](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard)
   now.
 * Clipboard is available only in HTTPS. I think you host your site on localhost
   with HTTP or somewhere else with HTTP. So, copy button will not work this way.
 *  Thread Starter [aakashmittalwp578](https://wordpress.org/support/users/aakashmittalwp578/)
 * (@aakashmittalwp578)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/copy-code-button-not-working/#post-18527889)
 * Yes, I am checking on localhost.
 * Thanks for your support

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Copy code button not working’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/urvanov-syntax-highlighter.svg)
 * [Urvanov Syntax Highlighter](https://wordpress.org/plugins/urvanov-syntax-highlighter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/urvanov-syntax-highlighter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/urvanov-syntax-highlighter/)
 * [Active Topics](https://wordpress.org/support/plugin/urvanov-syntax-highlighter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/urvanov-syntax-highlighter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/urvanov-syntax-highlighter/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [aakashmittalwp578](https://wordpress.org/support/users/aakashmittalwp578/)
 * Last activity: [11 months, 1 week ago](https://wordpress.org/support/topic/copy-code-button-not-working/#post-18527889)
 * Status: not resolved