Use a conditional statement to check if `$_POST['category_id'])` is an integer first. The PHP function is `is_int()`[1] if(isset($_POST['category_id']) && is_int($_POST['category_id'])){ update_post_meta($post->ID, 'category_id', $_POST['category_id']); } [1]: http://php.net/manual/en/function.is-int.php