acf form update post

Solutions on MaxInterview for acf form update post by the best coders in the world

showing results for - "acf form update post"
Liam
15 Oct 2020
1<?php function my_pre_save_post( $post_id ) {
2      // Create a new post
3      $post = array(
4      	'post_status'  => 'publish' ,
5      	'post_type'		=> 'acquisitions',
6   		//Use the ACF fields to create the title or any other field.
7      	'post_title'  => 'Acquisition' . ' ' . current_time( 'd/m/Y H:i:s', $gmt = 0 ),
8      );  
9
10      // insert the post
11      $post_id = wp_insert_post( $post );
12   	 // return the new ID
13   	 return $post_id;
14    }
15
16add_filter('acf/pre_save_post' , 'my_pre_save_post', 1, 1 ); ?>
17
18<?php acf_form_head(); ?>
19
20<?php get_header(); ?>