Closed sean-mystyle closed 1 year ago
The dequeue functions worked for most scripts and styles including ayecode-ui.
The only one that didn't work was font-awesome, which I didn't realize until after many many attempts programmatically, is actually an option in Wordpress Admin > Settings > Font Awesome where you can choose to only load it in the backend. Doht! Glad we found it eventually though because the dequeue would simply not work for that no matter how many ways we tried it.
First off, this would be a great potential feature to add in Settings for the plugin, too, something like a checkbox that says "Do not enqueue assets (scripts or styles) on non-usersWP related pages." like some plugins have, to reinforce the "lightweight" aspect of UsersWP that makes it great. In the meantime, it can be done manually to some extent.
The purpose is to remove any render blocking resources to increase page speed scores, without installing another plugin to do so. IE most all of these:
I'm currently seeing a loss of like .5 seconds to 1+ second on UsersWP assets loading on page, which I'd like to take out when they're not necessary. Google's mark for a "good" page experience is now 2.5 seconds, which leaves little room for unnecessary asset load times. As such I'd like to filter out the plugin on pages that it's not needed for by dequeuing the styles and scripts we don't need, so that another optimization plugin doesn't need to be added to the stack.
Do you have any suggestion on how to do this, if you've done it before yourself, or perhaps a function you're already using to do the same type of check, something like a
is_users_wp()
to check if it's a page usersWP runs on? With that we can implement something pretty simple likewp_dequeue_style( 'ayecode-ui' );
...and so on.
Of course, this is assuming that we do not use the lightbox popup login features or anything like that where the plugin assets would be required on every page.
Thanks a lot for any suggestions.