On one of the sites I manage, I have a custom shortcode for displaying content that (long story short) had to be manually placed/rearranged before. The shortcode works on other sites using it, but on this one it fails when I play it at the very top of the page content.
The way the sites are set up, a page holds the content for the front page (but it's separate from the page set as the front page). The shortcode is placed in the content page. I retrieve that page using get_page(), then run $page->post_content through wpautop() and then run do_shortcode() on the autop'd content. (Yes, I know this process is convoluted, just roll with it.)
So, I get content back during wpautop(). Everything is fine and dandy. I get output from the shortcode function when I var_dump() instead of return. But, if I let it fully process do_shortcode() the content switches from lovely, formatted content to NULL. Unless I move the shortcode to the bottom of the content. Then it works just fine.
Any ideas on why it would clobber all the content? There's nothing wrong with the code - it's working on many other sites - so it has to be some unaccounted difference in the content, but I have no clue where to start looking.