Wordpress wp_query group by custom field

前端 未结 2 1118
星月不相逢
星月不相逢 2021-01-07 06:06

I have to make a search form where i have to populate a select by the states of custom posts types. Some of them have the same state, then I would like to group-by to have a

2条回答
  •  情书的邮戳
    2021-01-07 06:27

    I had to make a few improvements to Chirag Patels Code, to get it working:

    postmeta . '.meta_value ';
        }
    ?>
    
     'observatoire',
        'post_status' => 'publish',
        'posts_per_page' => -1,
        'meta_key' => 'state'
    )); 
    ?>
    
    
    

提交回复
热议问题