Replace a character in all post titles and slugs


I have hundreds of posts whose titles are of the form XmY, where X and Y are natural numbers, for example 18m324.

I’d like to replace m with p in all post titles and slugs, while keeping X and Y unchanged. How to do it in phpmyadmin?

UPDATE wp_posts
SET post_title = 
REPLACE(post_title, 'm' , 'p')
WHERE post_type = 'post' AND post_status = 'publish';

This code should replace in the titles, but what about the slugs?

, sound wave 3 years 2019-11-04T23:44:23-05:00 0 Answers 75 views 0

Leave an answer