Title: Overrule update_post_meta
Last modified: August 22, 2016

---

# Overrule update_post_meta

 *  [Sven de Bie](https://wordpress.org/support/users/debiesven/)
 * (@debiesven)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/overrule-update_post_meta/)
 * I currently have the following code:
 *     ```
       add_action('update_post_meta','dbp_wc_price_update_meta',10,4);
       function dbp_wc_price_update_meta($meta_id, $post_id, $meta_key, $meta_value){
       	if( in_array($meta_key,array('_price','_price_var') ) ){
       		$meta_value	= str_replace(',','.',$meta_value);
       	}
       return $meta_value;
       }
       ```
   
 * I want to make sure that there are no commas in the meta_value before it is saved.
   But with the hook and function above it is just saved as it is.
 * When I save 5,95 it still is saved as 5,95, but I want it to be saved as 5.95.

Viewing 1 replies (of 1 total)

 *  [Barrett Golding](https://wordpress.org/support/users/hearvox/)
 * (@hearvox)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/overrule-update_post_meta/#post-5480479)
 * Could it be your `if` statement is evaluating `false`, so the function just returns
   the same `$meta_value` passed to it, unchanged.

Viewing 1 replies (of 1 total)

The topic ‘Overrule update_post_meta’ is closed to new replies.

## Tags

 * [overrule](https://wordpress.org/support/topic-tag/overrule/)
 * [update_post_meta](https://wordpress.org/support/topic-tag/update_post_meta/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [Barrett Golding](https://wordpress.org/support/users/hearvox/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/overrule-update_post_meta/#post-5480479)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
