Skip to content

Instantly share code, notes, and snippets.

@rahularyan
Last active December 3, 2017 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahularyan/7bd9c10783ce07d200f67c1042f52884 to your computer and use it in GitHub Desktop.
Save rahularyan/7bd9c10783ce07d200f67c1042f52884 to your computer and use it in GitHub Desktop.
<?php
/**
* Save a upload field.
*/
function my_save_pdf_uploads( $post_id ) {
$field = $form->find('pdf');
$field->save_uploads();
foreach( $field->uploaded_files as $filename => $id ) {
update_post_meta( $post_id, 'my_custom_pdf', $id );
}
}
add_action( 'ap_processed_new_question', 'my_save_pdf_uploads' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment