I wrote a very simple plugin to add custom fields to media library but in the database wp_postmeta table shows that there is no meta data for my pdf. I am supposed to get serialized meta data in the meta_value column. Is my plugin incorrect below?
The plugin achieves adding the custom fields but not saving to the database.

meta_id post_id meta_value
552 356 a:0:{}
551 356
Plugin Code
<?php
/*
Plugin Name: Media Library Fields
Plugin URI: http://mhmintranet
Description: The plugin adds additional fields to the media library
Version: 1.0
Author: me
Author URI: Metropolitan State Hospital http://mhmintranet
License: GPL2
*/
function GetCustomFormFields($form_fields, $post)
{
$form_fields['RevisionDate'] = array(
'label' => 'Revision Date',
'input' => 'text',
'value' => get_post_meta($posdt->ID, '_RevisionDate',true),
'helps' => 'This is the date the document was revised last'
);
$form_fields['ADTitle'] = array(
'label' => 'AD Title',
'input' => 'text',
'value' => get_post_meta($posdt->ID, '_ADTitle',true),
'helps' => 'Administrative Directive Title'
);
$form_fields['AdNumber'] = array(
'label' => 'AD Number',
'input' => 'text',
'value' => get_post_meta($posdt->ID, '_AdNumber',true),
'helps' => 'Administrative Directive Title'
);
return $form_fields;
}
add_filter("attachment_fields_to_edit", "GetCustomFormFields", null, 2);
function SaveCustomFormFields($post,$attachment)
{
if(isset($attachment['RevisionDate']))
{
update_post_meta($post['ID'], '_RevisionDate', $attachment['RevisionDate']);
}
if(isset($attachment['ADTitle']))
{
update_post_meta($post['ID'], '_ADTitle', $attachment['ADTitle']);
}
if(isset($attachment['AdNumber']))
{
update_post_meta($post['ID'], '_AdNumber', $attachment['AdNumber']);
}
return $post;
}
add_filter('attachment_fields_to_save','SaveCustomFormFields');
?>
I was missing add_filter(‘attachment_fields_to_save’,’SaveCustomFormFields’,null,2);