Restrict scripts and styles to plugin pages only
-
Hey there,
I found the disturbing look of whole WordPress Dashboard with some weird look and feel (all is plain, huge and white-ish, broken Media Library grid, messed up post/page edit screen). Tracked down that is caused by your plugin Fifth Insights because you enqueue admin scripts on all dashboard pages, not only on your plugin pages.
Can you please fix that issue? Hints:
- Remove
add_action("admin_enqueue_scripts", "fifth_insight_enqueue_scripts");
from index.php - Add to
includes/hooks.php
a new functionfunction fifth_insight_load_admin_assets() { add_action("admin_enqueue_scripts", "fifth_insight_enqueue_scripts"); }
- Add to the end of function
fifth_insight_admin_menu()
in fileincludes/hooks.php
following code:$scopes = [ 'toplevel_page_analyze-performance', 'fifthinsight_page_performance-report', 'fifthinsight_page_performance-comparison', 'fifthinsight_page_performance-full-report', 'fifthinsight_page_performance-setting', ]; foreach ( $scopes as $scope ) { add_action( 'load-' . $scope, 'fifth_insight_load_admin_assets' ); }
Thanks,
Aleksandar - Remove
- The topic ‘Restrict scripts and styles to plugin pages only’ is closed to new replies.