Skip to content

Instantly share code, notes, and snippets.

@anthonybudd
Last active February 12, 2017 14:36
Show Gist options
  • Save anthonybudd/e6ec4fd1b841636ce42e225a322dceab to your computer and use it in GitHub Desktop.
Save anthonybudd/e6ec4fd1b841636ce42e225a322dceab to your computer and use it in GitHub Desktop.
<?php
Class Product extends WP_Model
{
...
public $filter = [
'weight',
];
public function _filterWeight($value){
return intVal($value);
}
}
$product = Product::insert([
'weight' => '250'
]);
echo $product->weight; // (int) 250
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment