Title: Disable custom script
Last modified: August 22, 2016

---

# Disable custom script

 *  Resolved [Digict](https://wordpress.org/support/users/digict/)
 * (@digict)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/disable-custom-script/)
 * I’m using the ClickDesk system by inserting their code into my themes admin panel
   which has an option for custom code.
 * It works fine, but we want to disable the code for administrators, but nothing
   I have tried is working.
 * Here’s the code I tried without any luck.
 *     ```
       if ( !is_admin() ) {
       <!-- ClickDesk Live Chat Service for websites -->
       <script type='text/javascript'>
       etc etc etc etc
       </script>
       <!-- End of ClickDesk -->
   
       }
       ```
   
 * Thanks for any help!

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

 *  [spgandhi](https://wordpress.org/support/users/spgandhi/)
 * (@spgandhi)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/disable-custom-script/#post-5457092)
 * Hi,
 * You are using the wrong function to check if the user is admin.
 * is_admin() checks if the url loaded is of backend or frontend.
    You can read 
   the is_admin() documentation here – [http://codex.wordpress.org/Function_Reference/is_admin](http://codex.wordpress.org/Function_Reference/is_admin)
 * You need to use this function to check if the user is administrator – [http://codex.wordpress.org/Function_Reference/current_user_can](http://codex.wordpress.org/Function_Reference/current_user_can)
 * Let me know if you need more help.
 * Shreyans
 *  Thread Starter [Digict](https://wordpress.org/support/users/digict/)
 * (@digict)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/disable-custom-script/#post-5457195)
 * Thank you.
 * I tried using this without success. Am I on the right path?
 *     ```
       if ( ! current_user_can('install_plugins') ) {
       Click desk code
       }
       ```
   
 *  Thread Starter [Digict](https://wordpress.org/support/users/digict/)
 * (@digict)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/disable-custom-script/#post-5457200)
 * Ok I got it working.
 * Putting the code in the templates admin panel didn’t work, but putting it in 
   the actual .php file does. In the end here’s the code I got to work.
 *     ```
       <?php if (! current_user_can('install_plugins') ) { ?>
   
       <!-- ClickDesk Live Chat Service for websites -->
       <script type='text/javascript'>
       etc etc etc
       <!-- End of ClickDesk -->
   
       <?php } ?>
       ```
   
 *  [spgandhi](https://wordpress.org/support/users/spgandhi/)
 * (@spgandhi)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/disable-custom-script/#post-5457203)
 * Great.

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

The topic ‘Disable custom script’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [spgandhi](https://wordpress.org/support/users/spgandhi/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/disable-custom-script/#post-5457203)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
