• Hello, i have problem, please can you help me?

    I have field meta key (sort_custom), i need first sort by my field, then order popularity (total_sales)

    my code

    $args = array(
    
    		'orderby'  => array( 
    			'meta_value_num' => 'ASC', 
    			'total_sales' => 'DESC' 
    			),
    		'meta_key' => 'sort_custom'
    
    		);

    it’s doesn’t work!
    if i use “date/title” instead “total_sales, it’s work, but i need work my_field(meta_key) + total_sales, need
    first order my field then sort total_sales

  • The topic ‘order by 2 meta field’ is closed to new replies.