Home Forums Front-end Issues update_field() for comment fields


update_field() for comment fields

  • There doesn’t seem to be an equivalent to the update_field() function for comment fields. Attempting to update comment fields with that function inserts rows into the postmeta table rather than commentmeta. Is there a workaround for this?

  • Hi @zanetaylor
    I also needed to update the custom fields associated with a comment and I discovered that the function update_field () can be used, as in other cases. In the case of comments, however, it is necessary to pass the object and not the ID, as in this example.

    update_field( 'field_5a46bb8740511', $value, get_comment($comment_id) ); 
  • Excellent! Thank you very much. 👏

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘update_field() for comment fields’ is closed to new replies.