WordPress.org

Ready to get started?Download WordPress

Forums

importing data into a customfield table (2 posts)

  1. tipunch
    Member
    Posted 7 years ago #

    I have searched the fora but do not find a similar faq.

    I have a WP data base of items where each post has a custom field "Price". At present it contains the prices for 2006. For the same number of posts, I just need to update the prices for 2007, replacing old ones, from a csv file (?), without touching any other aspects of the posts.

    Is this possible, I presume with phpAdmin? I've done backups of the entire WP database, but I'm scared of doing something stupid that will crash everything. Any kind soul to point me in the right direction? Many thanks

  2. MichaelH
    Member
    Posted 7 years ago #

    Assuming you've used the Price custom field on a number of posts and want to change any Price custom field to be a new value. Also, assuming your $table_prefix in wp-config.php is 'wp_' the following code could be used in phpMyAdmin to update your values. This does not address reading the values out of your .csv file. This example changes the Price to 6255.55.

    UPDATE wp_postmeta SET meta_value = '6255.55' WHERE wp_postmeta.meta_key = 'Price';

    Having a backup before doing this is a great idea.

    Additional resource:
    Database Description

Topic Closed

This topic has been closed to new replies.

About this Topic