• how to display top downloads items by top count downloads in WP_Query meta_key

    • This topic was modified 5 years, 2 months ago by egh9.
Viewing 1 replies (of 1 total)
  • Hi @egh9

    Yes, you can display the top selling product with simple WP_Query. There are two meta key which you can use in WP_Query.

    1) _edd_download_earnings
    2) _edd_download_sales

    Below is the code snippet,

    $args = array(
    	'post_type' 		=> 'download',
    	'post_status' 		=> array( 'publish' ),
    	'orderby' 		=> 'meta_value_num',
    	'order' 		=> 'DESC',
    	'posts_per_page' 	=> 10,
    	'paged' 		=> 1,
    	'meta_query'		=> array(
    					array(
    					'key'     => '_edd_download_sales',
    					'value'   => 0,
    					'compare' => '>',
    					'type'    => 'numeric'
    					),
    				),
    );
Viewing 1 replies (of 1 total)
  • The topic ‘display top downloads or sales by WP_Query meta_key’ is closed to new replies.