Home Forums ACF PRO Save edited post as pending / add acf field title Reply To: Save edited post as pending / add acf field title

  • Hi @beee

    There’s some different ways to go about it. Since you’re using the pre_save_post hook you could just as easily change the title acf field value straight in the $_POST.

    You would only need to remove the save_post action hook IF you’re doing a function that itself would call to the same action (like wp_insert_post or wp_update_post). That would result in an infinite loop. However you’re not using any of those so you’re fine.

    Basically.. your function looks fine and it works. But it might be better practice to not use the $wpdb object. One thing you need to change tho if you continue to use this is the prepare function for $wpdb. Since you’re inserting information from variables (in the front end none the less) you should really make sure to prepare them even tho you’re sanitizing the value before insertion.