Introduction
Sometimes, plugins or themes load scripts and styles on the WordPress login page that are not required. These extra assets can affect performance or cause styling conflicts. You can prevent specific scripts or styles from loading by dequeuing them using a small custom function. This guide explains how to safely dequeue unnecessary scripts and styles.
Custom Workaround
Before proceeding, make sure you have a complete site backup.
- Go to Appearance > Theme Editor in your WordPress dashboard.
- Under Select theme to edit, choose your active theme (preferably a BuddyBoss Child Theme), then click Select.
- From the Theme Files list, open Theme Functions (functions.php).
- Add the following code just before the closing PHP tag (?>):
function tirarScripts() {
wp_dequeue_style( 'slate-js' );
}
add_action( 'login_enqueue_scripts', 'tirarScripts' );- Click Update File to save the changes.
This will prevent the specified style or script from loading on the WordPress login page.
Troubleshooting and FAQs
Q: How do I find the correct script or style handle?
A: You can inspect the login page source code and look for the id attribute on <link> or <script> tags, or ask the plugin/theme author for the correct handle name.
Q: Will this affect other pages on my site?
A: No. This code only affects the WordPress login page because it uses the login_enqueue_scripts hook.
Q: How do I revert this change?
A: Remove the added code from functions.php and save the file.