Expertise level: medium-low; I'm not afraid to find a file and edit it, but I don't really understand the inner workings of PHP.
I'm trying to restore a WP blog from backup, but with a fresh 3.7.1 install and a lot more attention to security after a hacking incident. Among other things, I've used Better WP Security to rename the wp-content folder.
My steps were:
The database restore went fine, and the site is about 90% there, but nothing that linked to the old uploads folder in wp-content is linking now.
I've searched and replaced all of the instances of wp-content on the site using an FTP program and Sublime Text, but I'm still not getting any re-linking. Images are still being sought with generated HTML that looks for things like http://foo.com/wp-content/uploads/2012/12/pants.jpg.
Where else do I need to look for and replace wp-content to the new content folder name? I've tried poking around in the database but I have no idea where to look or what to look for.
I've never used Better WP Security, but if you need to update references to wp-content
in the database, the best way to update the database is the Search and Replace for WordPress Databases Script mentioned in the Codex. Don't just try updating the database manually - if the fields contain PHP serialized data (a lot of them do) you'll break things.
Sounds like you already have a database backup, so you should be safe just to give the script a try. The search and replace values will depend on how Better WP Security works, but if the directory is just renamed (to, say, newname
), using /wp-content/
and /newname/
should do the trick.
Wordpress saves the attachments URL in the database so you have to replace the image paths in the sql dump (you can use sed ). You don't have to touch the wordpress core and in the wordpress themes the attachments won't show in the htmls cause were called by wordpress functions. You can make this
That should work