The plugins_url utility function, used in conjunction with the __FILE__ PHP constant and the name of our favicon file, enables us to quickly get the URL of the directory where our plugin files are located and print out the appropriate HTML command to notify browsers of the location of this file:
plugins_url( $path, $plugin );
The plugins_url function can be called with or without parameters. In the first case, it builds a URL by appending the path found in the first parameter to the location of the file specified in the second argument. In the second situation, it simply returns the location of the plugin directory.
Before we display our plugin's favicon file, we also check to see whether the user has already assigned a site icon using the WordPress customizer. If that is the case, we give priority to that icon and display it using the built-in wp_site_icon function.