• I cannot change the user_ID with wp_update_comment. This example is working, the content is updated but not the user_ID. I tried also user_id.
    Please help

    function update_user_id( $comment_ID) {
    	 $commentarr = array();
    		  $commentarr['comment_ID'] = $comment_ID;
    		  $commentarr['comment_content'] = 'Sample content';
    		  $commentarr['user_ID'] = 1; 
    
    		  wp_update_comment( $commentarr );  
    
    	}
    
    add_action( 'comment_post', 'update_user_id');
Viewing 1 replies (of 1 total)
  • The function wp_update_comment() doesn’t have the option to update the user id. It only updates these fields:

    • comment_content
    • comment_author
    • comment_author_email
    • comment_approved
    • comment_karma
    • comment_author_url
    • comment_date
    • comment_date_gmt
    • comment_parent
Viewing 1 replies (of 1 total)
  • The topic ‘update comment author id with wp_update_comment’ is closed to new replies.