Support

Account

Home Forums General Issues How to descrease value of acf field in frontend after form submission ?

Unread

How to descrease value of acf field in frontend after form submission ?

  • Hello. I have a contact form 7 and i want to descrease value of acf filed by one after succesfull submission. How to do that ?

    I am trying something like this –

    function my_acf_update_value( $value, $post_id, $field ) {
    
    	        $value  = get_field('custom_field_name', $post_id);
    
    					$value--;
    
    	    return $value;
    }
    
    add_action('acf/update_value', 'my_acf_update_value', 10, 3);
    
    add_action('wpcf7_mail_sent', 'my_acf_update_value', 1);
Viewing 1 post (of 1 total)

The topic ‘How to descrease value of acf field in frontend after form submission ?’ is closed to new replies.