Skip to content

Instantly share code, notes, and snippets.

@anthonybudd
Last active May 26, 2017 19:03
Show Gist options
  • Save anthonybudd/90cf845dfcac19aeade85ccd4319ea53 to your computer and use it in GitHub Desktop.
Save anthonybudd/90cf845dfcac19aeade85ccd4319ea53 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