Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // http://www.gravityhelp.com/forums/topic/attachment-fields-to-edit
- // change 122 to your form ID
- add_action('gform_after_submission_122', 'add_attachment_meta', 10, 2);
- function add_attachment_meta($entry, $form) {
- // Get all images which are attached to this post
- $all_images = get_posts( array(
- 'post_type' => 'attachment',
- 'post_mime_type' => 'image',
- 'numberposts' => -1,
- 'post_parent' => $entry['post_id'] )
- );
- // Grab the photographer URL and NAME from the submitted entry
- $ent_name = $entry[32];
- $ent_url = $entry[33];
- // Loop through all image attachments
- foreach ( $all_images as $image ) {
- update_post_meta($image->ID, 'ent_photographer_name', $ent_name);
- update_post_meta($image->ID, 'ent_photographer_url', $ent_url );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement