Reputation: 564
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;
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
Upvotes: 1
Views: 53
Reputation: 11106
try
update wp_posts set post_content = replace(post_name, 'on-', '') where post_type = "post";
and omit the %
.
Upvotes: 3