# Writing a value from code

> Save a value from code with the same cleaning an editor's value gets.

Source: https://uglydev.com/recipes/writing-a-value-from-code/
Updated: 19 November 2026

```php
ugly_update( 'price', 120, $post_id );          // a post
ugly_update( 'tagline', 'Hello', 'option' );    // an options page
ugly_update( 'color', '#ff5500', 'term_12' );   // a term
ugly_update( 'bio', 'Chef', 'user_3' );         // a user

ugly_delete( 'price', $post_id );
```

What you write goes through the **same cleaning** as what an editor types. A price out of range is cut.
