Skip to content
Drupal 8 | Alter comments query to order by DESC as well as the default ASC.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Example module to change the sort order of comments in Drupal 8 using function hook_query_TAG_alter. It is possible to configure sort order (newer or older first) per comment field, using the "comment field configuration" in "manage fields and settings" for your content type.

Corresponding issue for Drupal 7:


Drupal 8.2.x database.api.php / Perform alterations to a structured query for a given tag:


Advanced comment field configuration



preview sort flat


preview sort threaded


You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.