Jump to content

Recommended Posts

Posted

Afternoon All,

 

I wonder if anyone can tell me how to use a MySQL command to change a string wherever it appears on a website. We are using Wordpress and I can access MySQL through phpMyAdmin with the host.

 

Quite simply I need to change Ysgol Gyfun Gwyr to Ysgol Gyfun Gŵyr - but there are rather a lot of them.

 

I have started to do it by hand but it's going to take a while. I need to change it on Pages and Posts in Welsh and English - so a command would be handy.

 

I'm off to search Google now but maybe someone here is quicker.

 

Thanks everyone,

 

Gareth

Posted

Backup your DB before continuing!

 

Login to your Wordpress DB, then run the following SQL query (all posts and pages are stored in the wp_posts table on a standard WP installation):

 

UPDATE wp_posts SET post_content = REPLACE(post_content, 'Ysgol Gyfun Gwyr', 'Ysgol Gyfun Gŵyr');

 

Funnily enough I had to do this myself over the weekend to update my own WP site!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...