Sort Replies Without Custom Query
-
Making a custom query do all the stuff that
if ( bbp_has_replies() ): while ( bbp_replies() ): bbp_the_reply(); endwhile; endif;
is not feasible.
I tried modifying the query viapre_get_posts
but adding thevote_sort
–score_desc
doesn’t seem to have any effect. code:add_action( 'pre_get_posts', 'custom_pre_get_posts' ); function custom_pre_get_posts( $query ) { if ( bbp_is_single_topic() && ! $query->is_main_query() && ! is_admin() && $query->query_vars['post_type'] == 'reply' && $query->query_vars['post_parent'] ) { $query->query['vote_sort'] = 'score_desc'; $query->set( 'vote_sort', 'score_desc' ); } }
WP: 4.4.2
BP: 2.4.3
BBP: 2.5.8
- The topic ‘Sort Replies Without Custom Query’ is closed to new replies.