update comment author id with wp_update_comment (2 posts)

  1. bazel
    Posted 2 years ago #

    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');
  2. 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

Topic Closed

This topic has been closed to new replies.

About this Topic