Home Forums Backend Issues (wp-admin) acf/save_post not working Reply To: acf/save_post not working

  • Is this added to a file that is always loaded, like functions.php?

    Is there anything for ACF to save? There are fields being submitted? If there are no ACF fields submitted the acf action will never fire.

    function acf_save_post( $post_id = 0, $values = null ) {
    	// Override $_POST data with $values.
    	if( $values !== null ) {
    		$_POST['acf'] = $values;
    	// Bail early if no data to save.
    	if( empty($_POST['acf']) ) {
    		return false;
    	// Set form data (useful in various filters/actions).
    	acf_set_form_data( 'post_id', $post_id );
    	// Filter $_POST data for users without the 'unfiltered_html' capability.
    	if( !acf_allow_unfiltered_html() ) {
    		$_POST['acf'] = wp_kses_post_deep( $_POST['acf'] );
    	// Do generic action.
    	do_action( 'acf/save_post', $post_id );
    	// Return true.
    	return true;