call +44 (0)1273 622272
Find and replace links in WordPress
If you’d like to learn how to build a professional blog or site using WordPress, we run regular WordPress Training and Advanced WordPress Training in Brighton, Sussex . We also run a great 1-day Blogging Workshop.
OK – so you’ve built a killer blog using WordPress, and there’s loads of great articles and tips on there that link back to your site, driving loads of useful traffic.
And then – BLAM – one of your web developers changes your site structure, the URLs change and all of your links are broken. Aaaaargh!
OK – so you can solve it with a 301 redirect – but the best link juice comes from direct links to the correct URL – so you need to find and replace all the links in your WordPress site.
Suprisingly, WordPress doesn’t have a built in Find and Replace feature – so finding and reaplacing all of the links in your post is going to take aaaaaages – right?!
Wrong! All WordPress sites use a MySQL database as their back-end. So – if you can get at that database via phpMyAdmin (if you ask your web host they’ll tell you how), you can update all of the URLs in the whole blog (or any other text for that matter) using a simple command.
Here’s how…
1. Log in to phpMyAdmin and select your WordPress blog’s database from the drop-down:
![]()
2. Now pick the SQL tab from the top of the screen:
![]()
3. You’ll now see a big empty box where you can add SQL commands. Carefully copy and paste the command below in to the box, and replace http://oldurl.com and http://oldurl.com with the actual links you want to find and replace
UPDATE wp_posts SET post_content = REPLACE (post_content, ‘http://oldurl.com’, ‘http://newurl.com’);
![]()
4. Now just hit the “Go” button to run the command, and hey-presto – you’ve replaced all of the links in your whole WordPress blog with the correct URL – that’s just saved you about an hour of trudging through all your posts one by one!!
Don’t forget to check out our WordPress Training Courses if you want to get to grips fully with WordPress.
Find and Replace in Wordpress, Find and Replace links, Find and replace links Wordpress, Find and Replace URLs, Find and replace URLs Wordpress, How to find and replace in Wordpress, phpMyAdmin, sussex, Wordpress, WordPress Training, wordpress training sussex
Silicon Beach Training
Tweets that mention How to Find & Replace Links in a Wordpress Site « Silicon Beach Training Blog -- Topsy.com says:
[...] This post was mentioned on Twitter by heather buckley, Colin Welch and Silicon Beach, Notionline. Notionline said: How to Find & Replace Links in a WordPress Site http://bit.ly/9gRfqZ Fuente: @sbttraining [...]
2. 8. 2010 at 3:51 pm
Colin Welch says:
No problem – glad you found it useful
3. 8. 2010 at 9:10 am