Title: Use custom fields
Last modified: August 30, 2016

---

# Use custom fields

 *  Resolved [Tadaki1989](https://wordpress.org/support/users/tadaki1989/)
 * (@tadaki1989)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/use-custom-fields/)
 * First of all: great plugin! 🙂
 * I’d like to insert the uploader together with some custom fields. The plan is
   to read out the custom field values and do something else with them (in my case:
   automatically creating a post with the custom field values as post tags).
 * Can you give me a hint which php document I have to modify so that the custom
   field values can be read out and further processed?
 * [https://wordpress.org/plugins/wp-file-upload/](https://wordpress.org/plugins/wp-file-upload/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [davedi](https://wordpress.org/support/users/davedi/)
 * (@davedi)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/use-custom-fields/#post-6754867)
 * Hi. I am just starting to work on a similar use case.
 * I think you would not want to edit the plugin files directly as your customizations
   would be overwritten during an upgrade. That being said, you can find info on
   filters and actions (that you would use in your functions.php file) here: [http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/](http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/)(
   Scroll down to “filters/actions”).
 * If you have not already found how to add custom fields look here: [http://www.iptanus.com/the-new-form-fields-of-wordpress-file-upload-plugin/](http://www.iptanus.com/the-new-form-fields-of-wordpress-file-upload-plugin/)
 * Those are my next/first steps.
 * Good luck and let us know what you find.
 *  Thread Starter [Tadaki1989](https://wordpress.org/support/users/tadaki1989/)
 * (@tadaki1989)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/use-custom-fields/#post-6754875)
 * Hi davedi,
 * indeed I did change the plugin files directly because I couldn’t find another
   way to get to the field data. So I have to include the code again everytime I
   update WP File Upload… not perfect but manageable.
 * So what I did was changing wp-file-upload/lib/wfu_processfiles.php; right after
   the place when the final filename for the uploaded file is set (so right after
   the place in the code where it is defined what happens when a file with the same
   filename already exists, about line 425 or so), I put in the code lines below.
 * The variable which contains the submitted user fields data is called $userdata_fields.
   What I basically do is using the user field data to create a post with these 
   values. One user field defines the post’s category, another the post’s tags, 
   another the post’s title. The posts content is created by extracting the text
   of uploaded pdf files by means of the ‘pdftotext’ utility ($content in my example,
   not shown in the code below, [https://en.wikipedia.org/wiki/Pdftotext](https://en.wikipedia.org/wiki/Pdftotext)).
 *     ```
       $post_creation_date = current_time( mysql, 0 );
       $category_ID = get_cat_ID( $userdata_fields[1]['value'] );
       $post = array(
               'post_content'   => '<div class ="XY">' . $content . '</div>,
               'post_title'     => htmlspecialchars( $userdata_fields[0]['value'] ),
               'post_status'    => 'publish',
               'post_type'      => 'post',
               'post_author'    => 4,
               'post_date'      => $post_creation_date,
               'post_category'  => [$category_ID],
               'tags_input'     => htmlspecialchars( $userdata_fields[3]['value'])
       );  
   
       wp_insert_post( $post );
   
       }
       else {
       }
       ```
   
 *  Thread Starter [Tadaki1989](https://wordpress.org/support/users/tadaki1989/)
 * (@tadaki1989)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/use-custom-fields/#post-6754876)
 * Just noticed that there is a mistake in line four; right would be
 * `'post_content' => '<div class ="XY">' . $content . '</div>',`
 *  Plugin Author [nickboss](https://wordpress.org/support/users/nickboss/)
 * (@nickboss)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/use-custom-fields/#post-6754945)
 * Hi,
 *  sorry for my delayed response, do you still have the problem?
 * Nickolas
 *  Thread Starter [Tadaki1989](https://wordpress.org/support/users/tadaki1989/)
 * (@tadaki1989)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/use-custom-fields/#post-6754948)
 * No, it’s ok, thanks!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Use custom fields’ is closed to new replies.

 * ![](https://ps.w.org/wp-file-upload/assets/icon-256x256.png?rev=3252590)
 * [Iptanus File Upload](https://wordpress.org/plugins/wp-file-upload/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-file-upload/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-file-upload/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-file-upload/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-file-upload/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-file-upload/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Tadaki1989](https://wordpress.org/support/users/tadaki1989/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/use-custom-fields/#post-6754948)
 * Status: resolved