V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
yfalling
V2EX  ›  WordPress

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

  •  
  •   yfalling · Sep 10, 2019 · 2916 views
    This topic created in 2424 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   ·   2706 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 14:56 · PVG 22:56 · LAX 07:56 · JFK 10:56
    ♥ Do have faith in what you're doing.