I can't make add/update_comment_meta work
-
Hi mates,
does anyone have encountered this issue?
I’ve done some customization on theme’s comment form.
I added a new textfield to it however it’s not savingthis is the code I have in functions.php
$custom = $_POST[‘custom’];
add_comment_meta( $comment_id, ‘custom’, sanitize_text_field($custom[‘use_case’]), true )
or update_comment_meta( $comment_id, ‘custom’, sanitize_text_field($custom[‘use_case’]), true );this is working in my self hosted wordpress but it’s not working here in wordpress.com, are there some sanitizing requirements in order for it to work?
The blog I need help with is: (visible only to logged in users)
-
I’ve been able to solve the issue, I think there’s a problem on setting a unique to true, it’s now working after removing the boolean from the arguments
add_comment_meta( $comment_id, ‘custom’, sanitize_text_field($custom[‘use_case’]) )
or update_comment_meta( $comment_id, ‘custom’, sanitize_text_field($custom[‘use_case’]) );
- The topic ‘I can't make add/update_comment_meta work’ is closed to new replies.