Disable plugin javascripts in admin, but enable on front-end only?
-
I use wp_enqueue_script() within my plugins to add JavaScripts files to the site. I don’t want to load these JS in the admin panel, but to load them when viewing the website (while logged in too). I tried using is_admin(), and it seems to work. However, the JS won’t load on the public website when I am logged in. Is there a function I can use to fix this? Thanks!
function myfuncton() { if( !is_admin ){ wp_enqueue_script('myscript', $url_to . 'myscript.js', array('jquery','jquery-ui-core')); } } add_filter('init', 'myfunction');
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Disable plugin javascripts in admin, but enable on front-end only?’ is closed to new replies.