wordpress

I rebuilt my WordPress blog and had to change the image path, instead of changing it back straight away I kept using it, some images ended up in /wpcontents/uploads/* and some ended up in /wp-contents/uploads/*

So, naturally I had to change this back to /wp-contents/uploads and move all the existing files back, moving the files back wasn’t a problem but changing the image locations in the database was (without doing this completely manually and spending days on it)!

There are two ways of doing this, which will produce the same result, one is using phpMyAdmin and the other is using the command line and issuing sql commands. I will be only demonstrating the command line way as I don’t have phpMyAdmin installed, nor do I want to install it.

 

1. Shell to the server

2. Log into mySQL

3. Select database

4. Run the following

You will need to run both commands, change example.com and your path to the new ones you want to use)

Update wp_posts (post_content)

Update wp_posts (guid)

You should get a result like:

wordpress wp_posts sql update

Should you have any questions, comments or suggestions, please don’t hesitate to comment below. If you like what you have read, please share it on your favourite social media medium.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.