• Anonymous User 8443650

    (@anonymized-8443650)


    Is there any way to use get_posts() function to load the three most commented posts?
    Because I used this function to load the three most recent posts by this code:

    [...]
    $args = array( 'numberposts' => 3, 'orderby' => 'post_date', 'order' => 'DESC' );
    $myposts = get_posts( $args );
    [...]

    It worked. It loaded the three most recent posts, but when I tried to change the “orderby” from ‘post_date’ to ‘comment_count’, only one post was loaded.
    Is there any solution for this issue which doesn’t mean to use other function such as wp_query() or query_posts()?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Anonymous User 8443650

    (@anonymized-8443650)

    Does anyone knows how to solve the problem?

    Order by comment_count:
    $args = array( 'numberposts' => 3, 'orderby' => 'comment_count', 'order' => 'DESC' );

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using get_posts() function to load the three most commented posts’ is closed to new replies.