Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reorder Topics by Reply Count of each topic


  • wenghong216
    Participant

    @wenghong216

    Hi Guys, I’m having an issue where when I tried to order by meta_value under meta_key of ‘_bbp_reply_count’, it doesn’t give me the correct ordering as meta_value column is a varchar type of column. Is there any solution to this?

    #bbp_before_has_topics_parse_args

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

  • Robin W
    Moderator

    @robin-w

    this is the code bbpress uses

    $topics_query = array(
    
    					// What and how
    					'post_type'      => bbp_get_topic_post_type(),
    					'post_status'    => bbp_get_public_topic_statuses(),
    					'post_parent'    => $settings['parent_forum'],
    					'posts_per_page' => (int) $settings['max_shown'],
    					'meta_query'     => array( array(
    						'key'  => '_bbp_reply_count',
    						'type' => 'NUMERIC'
    					) ),
    
    					// Ordering
    					'orderby' => 'meta_value_num',
    					'order'   => 'DESC',
    
    					// Performance
    					'ignore_sticky_posts'    => true,
    					'no_found_rows'          => true,
    					'update_post_term_cache' => false,
    					'update_post_meta_cache' => false
    				);

    wenghong216
    Participant

    @wenghong216

    Hi Robin, when you are mentioning the above code is use by bbpress, is it mean that it will not apply exactly to buddyboss platform plugin?


    Robin W
    Moderator

    @robin-w

    buddyboss platform is paid, and I do not have it/use it, but it should be fine


    wenghong216
    Participant

    @wenghong216

    Thanks for the tips. I’ll work on it.

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