Title: error on update_metadata
Last modified: August 20, 2016

---

# error on update_metadata

 *  [Angela](https://wordpress.org/support/users/angelazou/)
 * (@angelazou)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/error-on-update_metadata/)
 * I have a custom metadata table for taxonomy.
 * CREATE TABLE IF NOT EXISTS `taxonomymeta` (
    `meta_id` bigint(20) unsigned NOT
   NULL AUTO_INCREMENT, `taxonomy_id` bigint(20) unsigned NOT NULL DEFAULT ‘0’, `
   meta_key` varchar(255) DEFAULT NULL, `meta_value` longtext, PRIMARY KEY (`meta_id`),
   KEY `taxonomy_id` (`taxonomy_id`), KEY `meta_key` (`meta_key`) ) ENGINE=MyISAM
   DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 * My PHP code is as follows. But the data doesn’t get inserted into the table. 
   Why?
 *     ```
       <?php
       add_action('category_add_form_fields', 'category_metabox_add', 10, 1);
       add_action('category_edit_form_fields', 'category_metabox_edit', 10, 1);
       add_action('created_category', 'update_category_metadata', 10, 1);
       add_action('edited_category', 'update_category_metadata', 10, 1);
   
       function category_metabox_add($tag) {
       	$output = '
       	<div class="form-field">
       		<label for="price">价格</label>
       		<input name="price" type="number">
       	</div>
       	';
       	echo $output;
       }
   
       function category_metabox_edit($tag) {
       	$output = '
       	<tr class="form-field">
       		<th scope="row" valign="top">
       			<label for="price">Pricing</label>
       		</th>
       		<td>
       			<input name="price" type="number" value="' . get_metadata("taxonomy", $tag->term_id, "price", true) . '">
       		</td>
       	</tr>
       	';
       	echo $output;
       }
   
       function update_category_metadata($term_id) {
       	update_metadata("taxonomy", $term_id, "pricing", $_POST['pricing']);
       }
       ?>
       ```
   

Viewing 1 replies (of 1 total)

 *  [Ryan Sutana](https://wordpress.org/support/users/ryscript/)
 * (@ryscript)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/error-on-update_metadata/#post-3434415)
 * Same here it didn’t save even I applied filter and action after add function,
   would be great is WP provide more sample and documentation, don’t have time to
   try and dig in myself 🙂

Viewing 1 replies (of 1 total)

The topic ‘error on update_metadata’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Ryan Sutana](https://wordpress.org/support/users/ryscript/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/error-on-update_metadata/#post-3434415)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
