Title: Save a caption
Last modified: December 30, 2023

---

# Save a caption

 *  [grahamtree](https://wordpress.org/support/users/grahamtree/)
 * (@grahamtree)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/save-a-caption/)
 * I have used this plug in to allow the users to upload a photo to my website and
   store it in the media library. How do I set the caption to the user field they
   entered please?
 * The application is for a sports club and the photo they upload is the team sheet
   so players know who it playing without visiting the club house.
 * Many thanks all.

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

 *  Plugin Author [nickboss](https://wordpress.org/support/users/nickboss/)
 * (@nickboss)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/save-a-caption/#post-17310817)
 * Hi, it can be done with a plugin hook, however you need the Pro version in order
   to create the hook.
 * Best Regards
 * Nickolas
 *  Thread Starter [grahamtree](https://wordpress.org/support/users/grahamtree/)
 * (@grahamtree)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/save-a-caption/#post-17311331)
 * thank you Nick,
 * that’s good to hear it can be done. I’m more than happy to purchase the Pro version,
   it’s a useful plug-in.
 * Would you show me how it is done with some sample code and where to place it,
   assuming I have one additional user field for the user to enter the details?
 *  Plugin Author [nickboss](https://wordpress.org/support/users/nickboss/)
 * (@nickboss)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/save-a-caption/#post-17312505)
 * Supposing that the caption is entered in the second user field, here is the hook
   code:
 *     ```wp-block-code
       if ( isset($GLOBALS["WFU_GLOBALS"]["WFU_DEBUG"]) ) $GLOBALS["WFU_GLOBALS"]["WFU_DEBUG"][3] = "ON";
       if (!function_exists('wfu_debug_wfu_process_media_insert_function_handler')) {
           function wfu_debug_wfu_process_media_insert_function_handler($res, $file_path, $userdata_fields, $page_id) {
               $attach_id = $res["output"];
               if ( $attach_id ) {
                   $caption = ( isset($userdata_fields[1]) ? $userdata_fields[1]["value"] : "" );
                   $args = array( 'ID' => $attach_id, 'post_excerpt' => $caption );
                   wp_update_post( $args );
               }
               $res["result"] = 'R';
               return $res;
           }
           add_filter('wfu_debug-wfu_process_media_insert', 'wfu_debug_wfu_process_media_insert_function_handler', 10, 4);
           $GLOBALS['wfu_debug_end-wfu_process_media_insert'] = "1";
       }
       ```
   
 * You need to put it in Hooks tab in plugin’s Dashboard area.
 * You can also put it in functions.php file of your theme. However the hook will
   be lost when you update the theme.
 * Nickolas

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

The topic ‘Save a caption’ 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/)

 * 3 replies
 * 2 participants
 * Last reply from: [nickboss](https://wordpress.org/support/users/nickboss/)
 * Last activity: [2 years, 5 months ago](https://wordpress.org/support/topic/save-a-caption/#post-17312505)
 * Status: not resolved