Support » Plugin: Fifth Insight » 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:

    1. Remove add_action("admin_enqueue_scripts", "fifth_insight_enqueue_scripts"); from index.php
    2. Add to includes/hooks.php a new function
      	function fifth_insight_load_admin_assets() {
      		add_action("admin_enqueue_scripts", "fifth_insight_enqueue_scripts");
      	}
    3. Add to the end of function fifth_insight_admin_menu() in file includes/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

  • You must be logged in to reply to this topic.