Hook after wp_enqueue_scripts

You can hook into wp_enqueue_scripts very late, using the priority argument of add_action. For example:

function hook_really_late() {
  echo 'Should reasonably be last';
}
add_action('wp_enqueue_scripts','hook_really_late',PHP_INT_MAX);

PHP_INT_MAX should be the highest number assignable as a priority. It is possible that some other code uses the same trick though. That is still probably what I’d recommend.

If you must be absolutely sure, wp_enqueue_scripts runs on the wp_head hook which is called by wp_head() so a similar trick should give you a very slightly better chance of running your code just after the scripts enqueue. Since wp_enqueue_scripts is hooked with a priority of 1, you’d want to use a priority of 1 also, or of 2. Since wp_enqueue_scripts is hooked by Core even with a priority of 1 your code should still come later than wp_enqueue_scripts but before anything else (with a reasonable margin of error).

function hook_really_late() {
  echo 'Should reasonably be last';
}
add_action('wp_head','hook_really_late',1);