Tabe I am using is wp_post_meta. It has Id, Meta_key and Meta_value column
I am trying to make an update for all links that are in the meta value where meta_key = description.
I have links in meta_value for ex: "https://test.com/today/11am/" needs to be changed to https://www.test.com/today/11am/
Links are dynamic, but all links that starts with https://test.com/ need to be changed to https://www.test.com/
Besides links in the column, there is another text.
Not sure if this is possible to do through a query, if yes please help somehow.
all links that starts with https://test.com/ need to be changed to https://www.test.com/
In an update you can do:
update t
set meta_value = concat('https://www.test.com/', substring(meta_value, 17))
where meta_value like 'https://test.com/%';
Note: You might want some condition on the meta_key
as well.
Assuming //
occurs only once in the string (reasonable for a URL), you could simplify this to:
update t
set meta_value = replace(meta_value, '//', '//www.')
where meta_value like 'https://test.com/%';
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments