I've read through the forums thoroughly and tried a few of the things I've seen, but wasn't able to get it to work.
I have a form that is posting to a custom post type. The form creates directory listings. The directory listing page templates only show posts in the future, so I'm trying to have the form post a date that is equal to today's date plus a year. The posts are going through okay but the date is not being changed. This is my current functions code:
add_filter('gform_pre_submission', 'set_post_date', 10, 2);
function set_post_date($post_data, $form){
return $post_data;
$today_date = date('Y-m-d'); /** CURRENT DATE*/
$time_value = date('H:i:s'); /** CURRENT TIME*/
$date_value = strtotime(date('Y-m-d', strtotime($today_date)) . '+1 year'); /** ADJUSTED DATE*/
$post_date = date("Y-m-d H:i:s",strtotime($date_value . " " . $time_value));
$post_data["post_date"] = $post_date;
return $post_data;
}
I also tried setting my filter to gform_post_data but that didn't change anything either.
Am I using the wrong filter to affect the post date?
All the Best,
Jason