When I try to update any specific comment’s acf field from front end by using following code snippet, it updates all comment’s acf field of the post.
$options = array(
‘fields’ => array(‘field_5863c431084e6’),
);
acf_form($options);
Kindly guide me, How can i resolve this issue.
Hi @dhruva81
I believe that’s because you didn’t pass the comment ID. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/acf_form/. So, it should be something like this:
$options = array(
// "99" is the comment ID
'post_id' => 'comment_99',
'fields' => array('field_5863c431084e6'),
);
acf_form($options);
Where “99” is the comment ID. To get the comment ID, kindly check this page: https://www.advancedcustomfields.com/resources/get-values-comment/.
I hope this helps 🙂
Thank you it is working.
I am using following code
$options = array(
‘post_id’ => “comment_{$comment->comment_ID}”,
‘fields’ => array(‘field_5863c431084e6’),
);
acf_form($options);