MYSQL remove word from a column in a table

I’m using wordpress and want to go through the entire wp_posts database using MYSQL to remove the word “on” from the slugs.

I’ve tried these two lines;

Read More
update wp_posts set post_name = replace(post_name, '%on-%', '') where post_type = "post";

select *, replace(post_name, '%on-%', '') from wp_posts where post_type = "post";

They dont remove the word ‘on’ from things such as “12th-annual-helmets-on-kids-campaign”

Thanks guys

Related posts

Leave a Reply

1 comment