Last active
February 6, 2017 16:55
-
-
Save anthonybudd/0f2e444cb3c935df345173c6e779552d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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