Please try this:
$args = array( 'post_type' => 'custom',
'posts_per_page' => 5,
'orderby' => 'comment_count',
'order' => 'DESC',
);
$my_query = new WP_Query( $args );
to order by the comment count.
Related Posts:
- How to Debug the ‘save_post’ Action?
- set_post_thumbnail_size in percent, not pixels?
- Breadcrumbs with Custom Post Types?
- Adding custom post types to archive.php
- How to query for posts (in hierarchical custom post type) that have children?
- 404 error PageNavi custom type taxonomy | wordpress
- Running a function on post content and CPT meta
- Custom Post Type and taxonomies’s labels localization not working
- get_the_post_thumbnail() returning empty string on custom post type
- Query for posts in 2 taxonomies
- How to add notification in the sidebar of the administration panel when a Custom post type is created? [duplicate]
- Custom Post Type get_post_type_archive_link( $post_type ) returns false
- How do I create an archive page for standard posts?
- custom taxonomy archive by year
- Add management screens to post type
- How to add the post ID (or any other post data) to a Contact Form 7 mail?
- Metabox Populated with a Custom Post Type – How to Output CPT based on Select?
- Can custom taxonomies items have attached properties?
- WordPress if in term*
- Associate custom post types with normal posts
- Combining sorted and random CPT
- how to delete all users and posts based on ‘user_meta’?
- custom-taxonomy/post_name instead of the default post_type/post_name
- Regex with a possible hyphen
- Expose a custom field of a custom post type to the REST API
- Rewrite Rule for showing Parent/Child Relationship between Two Hierarchical Custom Post Types
- Default text in a specific post type, but not visible?
- Woocommerce custom field search in custom post type [closed]
- Registering custom post type menu editor problem
- Save custom post type to external database
- Querying & displaying custom post type into an existent page [closed]
- Custom rewrite to fetch feed data
- Create custom post with meta field with AJAX and the WordPress REST API
- Change “empty trash” button text?
- Front end access to a SQL data repository – recommended way?
- Adding guestbook to my wordpress site
- Custom Post Type – Support “author” only for admins
- find custom post type post by searching its custom field with my string
- wordpress lists similar type of posts in a custom post type
- FacetWP paging custom wp_query
- Custom Post Type Template Hierarchy – Single post template
- How do I find a way to create a global single.php for a custom post type?
- Display Date & Author Info on Custom Post Type Archive Page
- Rewrite permalink for multiple post types (CPT) with taxonomy term
- How to Display the tag content of Custom Post?
- rewrite rules hierarchical
- Save custom post type not working
- Extra richtext admin textfield for custom posttype with toolbar tabs?
- either single-{custom}.php 404’s OR /taxonomy/ 404’s – custom post type and taxonomy permalinks
- Custom loop request based on custom field
- How do I list the next 7 days and any events (cpt) contained in those days
- Custom Post Types Not Showing Up In query_posts Result
- Do I need a loop to display an object that attached to posts?
- Remove filter and view options from custom post type edit screen
- How to get next post link of child custom post type from parent post and get next post link of parent post from the last child post?
- Using publish_{custom-post-type} hook for custom post type to update meta doesn’t work
- Select custom post type do display from page editor
- update custom taxonomy custom fields
- Get Custom Post types data from the API
- How to display “META” array in register_taxonomy
- CPTs relationship
- Search only one custom post type
- If ACF Post Object post has custom taxonomy term…
- How to group custom posts in admin menu based off taxonomy/postmeta
- publish_post action callback not executed, why?
- minimize wp_query call to database
- How to filter taxonomy of a custom post type and display it in the single post type page in the back end?
- Parent and child categories with their id in drop_down in CPT
- Some permalinks on Apache/localhost development setup return 404’s when set to anything other than plain permalinks
- sorting in wp query based on custom field value
- WooCommerce breadcrumb display custom posts instead of product data
- Include images from pages in wp search.php results in default wp search
- Custom post type post_type_link gives “page not found” on any other custom post type
- Taxonomy’s title
- Display all posts from single taxonomy term
- Enable shortcodes on custom post type
- Custom Post Type shows pagination (w/404) or posts_per_page query, but not both
- custom post type plugin – single template
- getting a blank login page :( any way I can fix this without having to do a clean install?
- Add a image to a post published on a CPT from the front-end
- Pulling in Related Posts based on Post Type array
- Paginate custom taxonomy category with wp_custom_pagination
- Page to show custom posts and one category
- Custom Search not working
- Custom post type post taxonomies
- Custom Template Taxonomy
- How to make nested custom post type slugs work
- pre_get_posts action doesn’t work
- Checking 2 dates against todays date
- WP Build-In Post selector for CPT
- Pagination not working with custom loop
- Bulk remove category from custom post type?
- Random meta field from specific custom post type
- How to relate one custom post type to another custom post type
- Hide custom post type and use its slug in new plugin menu
- Page template anomaly
- Can WordPress show posts based on a button that the user clicked 2 pages back?
- Creating post custom field text area
- Why isn’t page attributes dropdown not showing up in a custom post type
- Query order by a numeric ACF field