Advertisement
spencerbeggs

Rest Wordpress Rating

May 4th, 2011
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.37 KB | None | 0 0
  1. function reset_rating($post) {
  2.     $id = $post['ID'];
  3.     $update = $_POST['data key'];
  4.     if ($update === 'Rating') {
  5.         $newrating = $_POST['content'];
  6.         $currentrating = get_post_meta($id, 'Rating');
  7.         if ($newrating != $currentrating) {
  8.             update_post_meta($id, 'Previous Rating', $currentrating);
  9.         }
  10.     }
  11.     return $post;
  12. }
  13. add_filter('wp_insert_post_data', 'reset_rating');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement