Ecommerce Shopify WordPress Discussion

wordpress post_exists() always fails with post titles containing '&'

I have a script that auto-creates posts from data provided, the main check that it does before creating a new post is to see if any post already exists with the title provided $post_id = post_exists($title, '', '', 'cpt'); The problem is it fails with any post containing '&'. I have the incoming title wrapped in html_entity_decode before I pass it to wp_insert_post(), and even before formatting it with this, all of the incoming titles are using the '&' character and not any html entity or other format. When I check in the wordpress database, the titles are also saved with the '&' symbol. But for some reason, the post_exists() check fails on all of them. I'm kind of at a loss, any help would be greatly appreciated! Edit: I've basically admitted defeat, I'm now just running str_replace('&', 'and', $title) on all my titles and that has resolved the issue.
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.