Advertisement
chrishajer

Add first and last name to post tags

Aug 10th, 2012
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. <?php
  2. // http://www.gravityhelp.com/forums/topic/post-tags-auto-populatecontent-template
  3. // change the 15 to your form ID
  4. add_action('gform_after_submission_15', 'add_name_as_tags', 10, 2);
  5. function add_name_as_tags($entry, $form) {
  6.         // read the post ID from the entry and the first and last name from the $_POST
  7.         // change 6_3 and 6_6 to your form field IDs, using underscores
  8.         $post = array( 'ID' => $entry['post_id'], 'tags_input' => array(rgpost('input_6_3'), rgpost('input_6_6')));
  9.         // update the post
  10.         wp_update_post($post);
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement