Skip to content

Instantly share code, notes, and snippets.

@cernalpanic
Created December 5, 2012 21:18
Show Gist options
  • Save cernalpanic/4219594 to your computer and use it in GitHub Desktop.
Save cernalpanic/4219594 to your computer and use it in GitHub Desktop.
how to debug?
function debug_this($args) {
print_r($args);
}
add_filter( 'attachment_fields_to_save', 'RE_attachment_field_version_save', 10, 2 );
function RE_attachment_field_version_save( $post, $attachment ) {
debug_this(get_post_ancestors($post['ID']));
if( isset( $attachment['re-current-version'] ) ) {
//let's remove the current version setting in the db for this attachment type
//update_post_meta( get_post_ancestors($post['ID'])[0]), 're-current-version', $attachment['re-current-version'] );
//update_post_meta( $post['ID'], 're-currnt-version', 0 );
update_post_meta( $post['ID'], 're-current-version', $attachment['re-current-version'] );
}
return $post;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment