Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Recently I have deployed 2 sites from my local development area to the live site and ran into some issues when importing the posts. The reference link for attachments still points to my localhost for some of the attachments. I would like to remove the development sites but removing them will pull down the reference to some of the live attachments.

I was curious if anyone knows best practice for resolving this issue. I know all the attachments are on the live server just the reference is missing. I used custom fields with full paths for most these posts.

I have an idea of just editing the db directly to remove the reference to the files.

Thanks in advance for all help,

JN

share|improve this question
add comment

2 Answers

If I read correctly it's not just your custom meta but also your attachments (all images, videos, media, etc)

Do you have phpmyadmin? Do an export of the database and do a search for "http://yourlocalhostaddress.com" and replace with "http://yournewwebaddress.com" save and reimport

You can also do this with mysql but I'm very new to mysql commands and don't want to tell you the wrong one.

Again as Ethan mentioned always back up your database first.

share|improve this answer
add comment

As I read your question, it looks like you are using custom fields to store full paths. I think the cleanest way is to run a SQL query to cleanup your custom fields.

UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'MYOLDPATH', 'MYNEWPATH')
WHERE
meta_key = 'CUSTOMFIELDNAME'

Always backup your DB before you run an Update Query

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.