Hi,

Sorry – your code got stripped during sanitization, feel free to drop it in a gist if you want to share it.

Unfortunately this can be hit or miss and there are so many variables including what your theme or other plugins are doing I have found it is always a try it and see problem…
You could try varying the priority (99) to see if moving it a bit earlier or later helps. Or have a dig through the shortcode code (if they arn’t your own of course). Or lastly try the old faithful of disabling all plugins and using a WP theme (e.g.: TwentySeventeen) and testing it there as it could be a problem introduced by another plugin or theme.

All the best,
Phil