posts - Wordpress MySQL Search and replace with wildcard?

admin2025-06-02  0

I'm trying to search and replace for a link with wildcard in phpMyadmin.

If I simulate this query

UPDATE wp_posts SET post_content = REPLACE (post_content, '<a style="text-decoration:none" href="/spammy-url">.</a>','.');

It finds the exact match and will replace them successfully.

However due to the amount of links with different URL's i'd like to wildcard the query, If I navigate to the wp_posts table and do a search and replace, it displays all the correct entries that need to be replaced, however the column showing the "replaced" string doesnt change.

I thought doing the following would do it :

UPDATE wp_posts SET post_content = REPLACE (post_content, '<a style="text-decoration:none" href="%">.</a>','.');

But it's not returning any results. Do wildcards not work with search and replace in this way ?

If someone could explain where I am going wrong that would be great.

UPDATE

I have just tried to run the query via SSH and this is the notice I get :

Query OK, 0 rows affected (0.02 sec)
Rows matched: 3196  Changed: 0  Warnings: 0

So it found the rows required to change, but didnt change them. I think its something to do with the wildcard ( obviously ) but everything im trying comes up with the same result.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748834747a314113.html

最新回复(0)