[wp-hackers] Strange shortcode / header issue with search

Jeffrey Nolte jnolte at getmoxied.net
Tue Sep 25 00:49:04 UTC 2012

I currently have a very strange issue happening with a site that we recently developed.  Basically what happens is when there is a fresh search on the site and the post that is returned for the search results has an image gallery (that we set up as shortcode using wp media library) the photo gallery is injected into the dom before the opening html tag and this is done using javascript.  As you can imagine this completely mangles the layout of the site.  Does anyone have any ideas on the issue or somehow that I can start debugging it?  I have listed step by step what happens below.

1. Do a search for "television"
2. I am returned a page with results for "television" with a photo gallery injected into the dom before the opening html tag via JS.
3. I refresh the page and it is gone.

**Note: the photo gallery is a custom post type which is inserted into posts with a shortcode- there were many reasons for this approach as we needed to insert galleries into more than one post and replace a ton of flash galleries in existing content that was merged into new theme.

Some info about setup
WordPress 3.4.2
Relevenssi Plug-in for search
Running NGINX / w3 Total Cache and Varish with PHP-FPM
VPS Ubuntu 12.04 LTS

More information about the wp-hackers mailing list