detect when shortcode ran for the last time
Not sure about the last time, but you can hijack every shortcode and either call wp_localize_script() here or register an action for wp_footer that runs earlier than the footer script handler. Let’s say, this is the original: add_shortcode( ‘foo’, ‘original_function’ ); Now you can overwrite it with: add_shortcode( ‘foo’, ‘new_function’ ); function new_function( $atts, $content=””, … Read more