Advertisement
chrishajer

Set post title and slug to include entry ID

Jun 20th, 2013
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1. <?php
  2. // for Help Scout 25535
  3. add_filter('gform_post_data', 'set_post_title', 10, 3);
  4. function set_post_title($post_data, $form, $entry){
  5.     // Change the 23 here to your form ID
  6.     if($form['id'] != 23)
  7.         return $post_data;
  8.  
  9.     // set the title
  10.     $post_data['post_title'] = 'Entry #' . $entry['id'];
  11.  
  12.     // set the slug too
  13.     $post_data['post_name'] = 'entry-' . $entry['id'];
  14.  
  15.     return $post_data;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement