Support » Developing with WordPress » importing data into a customfield table

  • 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

Viewing 1 replies (of 1 total)
  • 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

Viewing 1 replies (of 1 total)
  • The topic ‘importing data into a customfield table’ is closed to new replies.