I have a theme name is mytheme
in themes/mythem/functions.php
I using code:
function remove_scripts() {
remove_action('wp_head','mytheme_head_scripts');
}
add_action('init', 'remove_scripts');
=>but result can’t remove all javascript, how to fix it ?
You either use the
admin_*/wp_print_scripts
hook or theadmin_*/wp_print_styles
hook. The styles hook comes before the print scripts hook, so maybe it fits better than just using a priority of0
for the*_print_scripts
hook (there might be function with a name that’s hooked in earlier on priority0
).If the function
mytheme_head_scripts
used priority while hooking intowp_head
then you must set yourremove_action
with same priority.Example –