Support

Account

Home Forums Backend Issues (wp-admin) CPT with custom datatable insert, update

Unread

CPT with custom datatable insert, update

  • Hello,

    I have a CPT with ACF and I have managed to get those fields to save to a custom data table.
    How can I update the same ACF values, with the same post_id, while I’m updating the CPT?
    Here is what I have done so far.
    Now how to update this?

    
    add_action('acf/save_post', 'my_acf_save_post');
      function my_acf_save_post( $post_ID ) {
                    global $wpdb;
    	        $table = $wpdb->prefix.'analiza';
                    $ime_radnika_1 = get_field('ime_radnika_1', $post_ID);
    		$data = array('post_ID'=>$post_ID,'name' => $ime_radnika_1);
    		$format = array('%d','%s');
    		$wpdb->insert($table,$data,$format);
    }
    
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.