Title: Load scripts only if the current user is admin using the wp_enqueue_script
Last modified: August 19, 2016

---

# Load scripts only if the current user is admin using the wp_enqueue_script

 *  [levani01](https://wordpress.org/support/users/levani01/)
 * (@levani01)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/load-scripts-only-if-the-current-user-is-admin-using-the-wp_enqueue_script/)
 * I’m currently using one plugin that loads too many javascript and css files on
   my site using the wp_enqueue_script function, but these files aren’t necessary
   for ordinary users, but only for administarors. How can I prenets these scripts
   loading if the current user isn’t admin in order to reduce the page load time?
 * Thanks in advance

Viewing 1 replies (of 1 total)

 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/load-scripts-only-if-the-current-user-is-admin-using-the-wp_enqueue_script/#post-1260281)
 * Hi
 * Here is a useful article on that
    [http://justintadlock.com/archives/2009/08/06/how-to-disable-scripts-and-styles](http://justintadlock.com/archives/2009/08/06/how-to-disable-scripts-and-styles)
 * Code to determine if admin is logged in
    `<?php if (current_user_can('level_10')){?
   >`

Viewing 1 replies (of 1 total)

The topic ‘Load scripts only if the current user is admin using the wp_enqueue_script’
is closed to new replies.

## Tags

 * [wp_enqueue_script](https://wordpress.org/support/topic-tag/wp_enqueue_script/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * Last activity: [16 years, 6 months ago](https://wordpress.org/support/topic/load-scripts-only-if-the-current-user-is-admin-using-the-wp_enqueue_script/#post-1260281)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
