When updating a post meta where the input will be always an integer, should I use (int)
or is there a WordPress function for that (eg. sanitize_text_field
)?
For example:
if(isset($_POST['category_id'])){
update_post_meta($post->ID, 'category_id', (int)($_POST['category_id']));
}