This bit of code will update the comment_post_ID
with the value submitted using your custom form.
function wpse405448_update_comment( $comment_ID, $comment_approved, $commentdata ) {
if ( isset($_POST['acf']['field_6278d64aecf19']) && !empty($_POST['acf']['field_6278d64aecf19']) ) {
$comment_post_id = intval($_POST['acf']['field_6278d64aecf19']);
$com_arr = array(
'comment_ID' => $comment_ID,
'comment_post_ID' => $comment_post_id,
);
wp_update_comment($com_arr);
}
}
add_action( 'comment_post', 'wpse405448_update_comment', 10, 3 );
Make sure both the comment_ID
and comment_post_ID
are valid. Otherwise it wont get updated.
Related Posts:
- comments_where Hook
- Advanced Custom Fields: how do I check to see if a value is set in an field? [closed]
- Advanced Custom Fields – Get custom fields from parent page
- Add custom field to the archive page?
- Matching Serialized Arrays with meta_query
- Show only posts which can be commented OR have custom meta field
- How to position a custom field before the editor
- Show Custom Comment Fields when editing in admin
- Display post_object content using Advanced Custom Fields plugin
- Remove old custom field after import
- Unable to get Preview of Uploaded image within a Custom Meta box
- Change content before writing to database
- How to make custom comment fields required and message field not required
- Order Custom post type loop by custom field (datepicker)
- Comments form custom fields order
- Using Custom Function With Advanced Custom Fields
- Problem with adding exta field in metabox in custom post type
- Copying Custom Meta Values from existing post to a duplicate post
- Calculate the sum of certain the_sub_fields
- Unable to show ACF’s Image Custom Field properly in Genesis Framework [closed]
- Login & Register & Custom details WITHOUT plugin
- Send Multiple Custom Field Values Through the URL
- ACF won’t load from a custom JSON location
- Show ACF fields only on certain page in the backend
- Update posts after populating ACF field value [closed]
- WP Custom Fields Metabox Disappears – ACF plugin issue [closed]
- Transfer self made functions.php custom fields to Advanced Custom Fields [closed]
- ACF: How to get the full field name (meta_key) by a field key?
- Dynamically fill a post custom field with post publish date
- How can I store a file in the database in the same way WordPress and ACF do?
- Will loading too many ACF Fields cause slow down?
- WP_User_Query pulling ACF to loop
- Calling the “wp-link-wrap” pop-up modal
- Print custom field in Query Loop block
- How to add Advenced Custom Fields In Single Post
- Order RSS content by an advanced custom field value
- Get an advanced custom field after post publish
- How to create a dropdown select of all items in an ACF field group
- Advanced Custom Fields dynamic update_field
- WooCommerce – Adding Custom Fields To Invoice
- Add & store extra fields – WordPress Comments
- displaying and sorting comments by a custom field (using PODS plugin) [closed]
- Sort custom post type by multiple custom fields
- Vimeo thumbnails
- Advanced Custom Fields WYSIWYG More tag
- Walker class for sub-menu with ACF fields
- comment meta_query for keys that aren’t yet set
- Custom fields issue [closed]
- Querying posts by latitude and longitude to build a Google Maps with several markers
- How to copy data from a custom field to the post_content?
- WordPress creates new lines in postmeta table on post update
- ul list with only as many li’s as filled custom fields
- Retrive Image URL of Custom Fields in Theme
- Display custom field from the front page on another page
- How to Pass values to Custom Field through PHP in WordPress Posts?
- Advanced Custom fields not available yet during publish_page action
- How can I output the custom fields wrapping with HTML
- The conditional logic only works to show or hide?
- ACF Plugin How to make the customer add more fields in the post?
- How to get custom image field of specific post id
- custom comment_form fields not displaying
- Editing custom fields for comments
- Need to search a custom field (ingredients, one long string per post), but want it to allow phrases/non-exact matches
- ACF field group not showing in page
- What am I missing in this Code Block?
- How to show ACF fields in Gridbuilder custom block
- get_field values for each post on home page using wp_add_inline_style
- How to set up page fields with gutenberg instead of ACF
- Shortcode for Custom Field of Media Attachment (to use with Featured Images)
- ACF multi taxonomy on filterable gallery
- How to use ACF with javascript to update custom field values?
- Weird custom fields data lost
- Retrive acf fields in publish_post action for wp_mail
- Getting user’s data, by custom field lookup (meta)
- How to delete attachments associated with custom field type when post property changes? [closed]
- ACF – Compare user and post data
- Counting number of images from loop
- Page template is missing fields or is invalid when I updating the template
- How to add content with a filter when there’s no content in the editor
- Advanced Custom Fields from Category – IF statement
- Using ACF Custom Field value in a URL with do_shortcode() [closed]
- display Flexible Fields from options
- WordPress taxonomy child image
- Filter and display a specific custom field value [closed]
- Display different category template if custom field is checked
- How to filter post using custom feild value in shortest and longest duration?
- Query Posts Via WordPress URL
- How to Order Posts by Custom Fields?
- Fetch data from a WP page with same name as current username
- Get custom field from other post in carousel
- I want to add a custom field in the rss title of each post, but don’t want it to be shown on the site
- Semi-Private Comments + page comments -> is it possible?
- Update field name without losing the value
- Advenced custom fields auto fill problem
- Add image custom attribute [closed]
- Truncating characters in Advanced Custom Fields works some places but not others?
- Conditional display based on ACF checkbox
- How to add an ACF only for parent term?
- Best way for managing images of ads banners
- ACF in radio button cf7