I want a MySQL query to find and replace keyword in wordpress database. And want to keep slugs unique. For example : If there are 3 slugs in the wp_terms
table :-
testkeyword
testkeyword-2
testslg
now I want to replace keyword slg
with keyword
and run the update query as
update wp_terms set `slug` = replace(slug, 'slg','keyword')
Now the third slug which was testslg
will become testkeyword
, and it will not remain unique, as the first slug exists same as the third.
How can I put a number at the end of slug if it already exists in a column?
As in this example I want the third slug to be testkeyword-3
. How is this possible?