I’m using Clipper, a coupon theme developed by AppThemes.com, and I’m trying to programmatically import coupons.

The problem I’m having is each coupon needs to have a “store” added when it’s uploaded.

I can add the “store name” just fine, but I’m not able to update one of the custom fields associated with the “stores” taxonomy.

Below is my code to update the custom_field. 41 is the term_id of the taxonomy I’m trying to update.

wp_update_term( 41, 'stores', 
array(
'clpr_store_url' => $url,
'clpr_store_aff_url' => $url
)
); 

It appears that “wp_update_term” does not allow me to update the field “clpr_store_url”.

Here is the documentation for the function but it doesn’t help me out:

http://codex.wordpress.org/Function_Reference/wp_update_term

2 Answers
2

wp_update_term does not support custom fields so you will need to use update_term_meta instead.

This stores values like this:

update_term_meta( $term_id, $metakey, $metavalue );

Your code should look something like this:

update_term_meta( 41, 'clpr_store_url', $url);
update_term_meta( 41, 'clpr_store_aff_url', $url);

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *