Skip to:

Activity stream comments and reply display order.

  • axelmire


    WP 4.8 BP 2.9

    Hi, I am trying to get the activity comments/reply stream to display in descending order. ie latest at the top.
    Activity stream updates display with the latest post at the top but currently comments/replies display with the oldest post at the top.
    I have been able to switch activity updates order by switching the sort order from ASC to DESC in bp-activity-template.php but this has no effect on comments/replies.

    How do I get comments/replies to function the same way as updates?

    Thanks for any help

Viewing 4 replies - 1 through 4 (of 4 total)

  • Boone Gorges


    Very interesting question.

    It’s not currently possible to do this through the regular activity API. We’ve hardcoded ASC into the comment query:

    I think that it would be a good enhancement request to add something to the query API that allows for these items to be reversed. If you’re interested, I encourage you to open a ticket at

    In the meantime, here’s a clunky workaround:

    add_filter( 'bp_has_activities', function( $has ) {
    	global $activities_template;
    	foreach ( $activities_template->activities as &$a ) {
    		$a->children = array_reverse( $a->children );
    	return $has;
    } );

    This will only affect top-level comments; you’d need something recursive to do deeper levels. And you may want to limit this to front-end queries, or in the main activity directory, or something like that. But it’s a basic technique that should give you a sense of how to solve this in the short term.



    That worked, thank you very much. 🙂



    Hey Boone I have managed to get things working with a little core tweaking for the time being. I have 2 remaining issues I am wrestling with that maybe you can help me solve.

    1. When the comment post form is opened it currently scrolls the form to the bottom of the comments. I would like to keep the comment form above the comments with no scroll.

    2. When multiple comments trigger the “Show all comments” message (seems to have a default of 5), the comments displayed show the oldest comments and not the newest.

    Any help is appreciated. 🙂



    Hello again…Ok, I have moved bp_activity_comments() inside the form div in entry.php which allows for clicking the comment button to open the comment box with the latest comments below.

    The current problem is when a new post is created it positions the new comment on the main time line by itself and above the comment post box until the page is refreshed and then it is back inside the form div below the comment post box again even though I have moved wp_nonce_field( ‘new_activity_comment’, ‘_wpnonce_new_activity_comment’ ) inside the form div.

    I am also trying to find a way to keep the comment box open when posting allowing the user to close the box via the cancel button.

    I have looked at the possibilities within the js files but I am stumped by this at the moment.

    I appreciate any pointers. 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar