WordPress.org

Support

Support » How-To and Troubleshooting » Using get_posts() function to load the three most commented posts

Using get_posts() function to load the three most commented posts

  • 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)
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.
Skip to toolbar