I’m posting this for the benefit of anyone who experiences a similar problem to mine when moving WordPress from a directory into the web’s root directory.
What happened was that many links and pictures, some placed in there by plugins, others simply links that were typed in, had failed.
I realised that although I’d followed the migration instructions, a lot of things were left poorly sorted. A quick run through of all the tables showed where values were left incorrectly set. To fix this I wrote the following SQL statements and applied them to my database:
update wp_posts set guid = replace(guid,”/wordpress”,””);
update wp_postmeta set meta_value = replace(meta_value,”/wordpress”,””);
update wp_options set option_value = replace(option_value,”/wordpress”,””);
update wp_posts set post_content = replace(post_content,”/wordpress”,””);
These worked a treat.
To use this yourself I’ve done a version below that you can edit – simply replace $$$olddir$$$ with your old directory name (in my case wordpress) and replace $$$newdir$$$ with your new directory name. If your new directory is the root, remove the / at the beginning of each $$$newdir$$$ – see my example above.
A couple of warnings though – first take a backup of your database! Then think carefully – if you don’t know what you’re doing you may well be advised in seeking someone out who does.
update wp_posts set guid = replace(guid,”/$$$olddir$$$”,”/$$$newdir$$$”);
update wp_postmeta set meta_value = replace(meta_value,”/$$$olddir$$$”,”$$$newdir$$$”);
update wp_options set option_value = replace(option_value,”/$$$olddir$$$”,”$$$newdir$$$”);
update wp_posts set post_content = replace(post_content,”/$$$olddir$$$”,”$$$newdir$$$”);
Good luck and have fun!