0

How can I deregister all wordpress scripts all at once except for the admin? I have looked at the discussion How can I de-register ALL styles all at once? And same with Javascript?, but i do not want to get the scripts enqueued just deregister them. The scripts should work for the admin.

0

Its already answered on this link

<?php
//To remove all script from the page
function remove_all_scripts() {
    global $wp_scripts;
    $wp_scripts->queue = array();
}
//  to remove all stylesheet
add_action('wp_print_scripts', 'remove_all_scripts', 100);

function remove_all_styles() {
    global $wp_styles;
    $wp_styles->queue = array();
}
add_action('wp_print_styles', 'remove_all_styles', 100);
?>

It will remove all the scripts enqueued by standard method. Manual script will not be removed.

Hope it will help

  • but how to make sure that the deregistered scripts work for the admin user – amandasage Sep 14 '14 at 17:36
  • Just add this script in you custom plugin then. Firebug to check. – Ashish T Sep 14 '14 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.