yfalling
V2EX  ›  WordPress

wp_query 中 meta_value 是数组,请问如何用 orderby+meta_value_num 排序?

  •  
  •   yfalling · Sep 10, 2019 · 2998 views
    This topic created in 2462 days ago, the information mentioned may be changed or developed.

    数据库中:meta_key ( shop_count )/meta_value ( a:3:{s:5:"total";s:2:"99";s:4:"sell";s:2:"16";}) 即为总数( total ):99 ;销售( sell ):16 ; 我想根据销售量排序,请问我该怎么写代码,这是我现在的代码: $args['meta_query'] = array( array( 'key'=>'shop_count', 'value'=> array('sell'), 'compare' => 'Like' ) ); $args['meta_key'] = 'shop_count'; $args['orderby'] = 'meta_value_num'; $args['order'] = 'DESC';

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5192 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 64ms · UTC 05:55 · PVG 13:55 · LAX 22:55 · JFK 01:55
    ♥ Do have faith in what you're doing.