Skip to content

Instantly share code, notes, and snippets.

@barryhughes
Last active November 23, 2019 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barryhughes/1d52e7562e5d2e6f5121981a4babdd36 to your computer and use it in GitHub Desktop.
Save barryhughes/1d52e7562e5d2e6f5121981a4babdd36 to your computer and use it in GitHub Desktop.
bbPress 2.6.x: don't allow "bumped" topics to surface to the top.
<?php
/**
* Order bbPress topic archives by post date (date created), not by last activity.
*
* This can be added either within a standalone plugin or to a theme's functions.php
* file.
*
* @param array $args
*
* @return array
*/
add_filter( 'bbp_after_has_topics_parse_args', function( array $args ): array {
// Normally bbPress sorts topics by last active (which is stored as meta data). Undo this.
unset( $args['meta_key'], $args['meta_type'] );
// Default ordering is DESC, so all we typically need to do here is switch to ordering
// by post date (date created).
$args['orderby'] = 'date';
return $args;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment