Skip to content

Instantly share code, notes, and snippets.

@anthonybudd
Last active February 6, 2017 16:55
Show Gist options
  • Select an option

  • Save anthonybudd/0f2e444cb3c935df345173c6e779552d to your computer and use it in GitHub Desktop.

Select an option

Save anthonybudd/0f2e444cb3c935df345173c6e779552d to your computer and use it in GitHub Desktop.
<?php
Class Product extends WP_Model
{
...
public function saving($model){
echo "The save method has been called, but nothing has been
written to the database yet.";
}
public function saved($model){
echo "The save method has completed and the post and it's
meta data have been updated in the database.";
echo "The Model's ID is". $model->ID;
}
}
$product = Product::find(15);
$product->color = 'green';
$product->save(); // Triggers events
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment