How to move a comment to another node in Drupal 8

Problem:
A customer of mine had two products on his website that where almost identical. He needed to combine the comments/reviews for both products on a separate page. So i created a new page called Reviews, containing the same comment field as the product page. But how to move comments from one node to another?

I could not find any information about how to achieve this through the Drupal 8 admin interface. So i found the best way was to make the change directly in the database.

Solution:

  1. Open phpMyAdmin
  2. In the comment_field_data table, look for the entity_id column. This column contains the node id of the node the comments are attached to. Change this number to the desired node id for each comment you want to move.
  3. Now go back to the new node and the comments should appear. If they don’t, try some of the following:
    • Clear the cache
    • Go to the edit screen of the node and save it (without editing anything)
    • Write a test comment on the node.
    • Make sure the comment field is not set to hidden in the field settings

Do you have any feedback or maybe even a better way to achieve this? Leave me a comment below:

x


Request a quote

I will get back to you within 24 hours.