Today I ran into a situation where a shortcode was processed twice in a page, although it was only once in the content of the page.
After a lot of trial and error / looking at what others have done in the past the problem went away when I stopped adding the registry of the shortcode through the init hook. The add_shortcode call is now all by itself in the functions.php file.
I noticed the problem because I needed to register the firing of the shortcode, after which some info was written to SESSION variables. This was done twice per page, so I was really surprised.
This process left me with 3 questions:
1. Will the fact that I stopped registry of the shortcode through the init hook assure me of the fact that the shortcode is only run once on a page? (assuming the shortcode is only once in the content of the page)
2. If it is still unknown how often the shortcode function fires: why is that? It seems to be bad for response times to execute a function twice, where once is sufficient.
3. Is there some way to guarantee that a shortcode is run exactly the number of times it is in the content of a page? Which is what you would expect intuitively. Isn't that so?