Skip to content

Instantly share code, notes, and snippets.

@iamtekeste
Created May 18, 2015 07:54
Show Gist options
  • Select an option

  • Save iamtekeste/df7bcf1d07f84bda3f54 to your computer and use it in GitHub Desktop.

Select an option

Save iamtekeste/df7bcf1d07f84bda3f54 to your computer and use it in GitHub Desktop.
Use value of post meta for something when the post meta changes
/**
* Use value of post meta for something when the post
* meta changes
* @param integer $meta_id ID of the meta data field
* @param integer $post_id Post ID
* @param string $meta_key Name of meta field
* @param string $meta_value Value of meta field
*/
function saveYouTubeInfo($meta_id, $post_id, $meta_key='',
$meta_value=''){
// Stop if not the correct meta key
if ( $meta_key != 'my_meta_field_name') {
return false;
}
// Function code goes here.
}
add_action('updated_post_meta', 'saveYouTubeInfo', 10, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment