Detects shortcodes before wp_head() call.
Detects shortcodes before wp_head() call to allow selective enqueuing of scripts and styles (i.e. js and css files) that are specifically used for the shortcode.
Make sure that the shortcode you want to detect is defined. If it is a WordPress shortcode then there's no need to define it.
<?php add_shortcode( 'my_shorcode', 'my_function' ); ?>
To detect the shortcode use the code below. Change 'my_shortcode' to the shortcode you want to detect.
<?php add_action( 'shortcode_detected_my_shortcode', 'my_add_resources_function' ); ?>