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

Daniel Bachhuber wordpress at danielbachhuber.com
Tue Sep 25 00:55:14 UTC 2012

Can you make sure the shortcode is returning its content, not echoing? This common mistake can produce results like you're seeing if the_content is applied to a post before the loop

On Sep 24, 2012, at 17:49, Jeffrey Nolte <jnolte at getmoxied.net> wrote:

> 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
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list