Support

Account

Home Forums Backend Issues (wp-admin) update_sub_field doing nothing, with or without keys. Reply To: update_sub_field doing nothing, with or without keys.

  • I’m not sure it’ll help you exactly, but figured I’d chime in with something I spent a while troubleshooting for update_sub_field(), for a custom admin interface I was working on. I wanted to update multiple fields within a Group, within a Repeater. Here’s my code:

    $values = array(
    	//field1 => value
    	'field_5aac179f96382' => 'emailed',
    	//field2 => value
    	'field_5aac164496381' => 'TEST5678!'
    );
    
    //update_sub_field( array(repeater_name, row_id, group_name), $values, post_id )
    update_sub_field( array('field_5a71dfd39fac7', 1, 'field_5a7209ec9facd'), $values, 116 )

    What I did to troubleshoot in my situation, was create a new WordPress page and outputted the above code on that page. Then, I know when I visit that page in the frontend, that my field “should” be updated on my post and if it doesn’t then there’s something wrong with my code.