Facebook Pixel causing WordPress media search to not work properly

Note to self but if you are helped by it then great. 🙂

I had a site where for some reason the media search wasn’t working. It was not actually filtering things like it should and just sort of re-arranged all the same results (but did not narrow them, no matter how specific my search query was). Same thing happened with searching through actual posts.

Turns out it was the Facebook Pixel plugin. I don’t know how or why but when that was active, it caused the problem. So I grabbed the code that it was generating and put it directly into the head, then deactivated it, and all seems to now be working fine. Very strange.

Don’t want to say it was definitely caused by a bug in that plugin, who knows if there was just a strange interaction with something else we were running, but that is what happened for us. So if you ever notice this problem on your site (and you’re running that plugin), try deactivating it.