Php 使用meta_键对post元数据进行排序?
我正在尝试获取帖子,wp_postemta表上的元数据。我需要使用meta_键和post id获取post id、meta键和meta值。存储的meta键是date。如,。2014-01-022014-02-03,我要按年份或月份查询Php 使用meta_键对post元数据进行排序?,php,mysql,wordpress,Php,Mysql,Wordpress,我正在尝试获取帖子,wp_postemta表上的元数据。我需要使用meta_键和post id获取post id、meta键和meta值。存储的meta键是date。如,。2014-01-022014-02-03,我要按年份或月份查询 $args = array( 'post_type' => 'calendar_holiday', 'ID' => $id; 'meta_query' => array( array(
$args = array(
'post_type' => 'calendar_holiday',
'ID' => $id;
'meta_query' => array(
array(
'key' => ,
'value' => ,
'compare' => 'LIKE'
),
)
);
$query = new WP_Query( $args );
我不知道该把什么放在钥匙和价值上。。有什么想法吗??谢谢
// 'orderby' => 'meta_value_num', // it's a numeric value
$args = array(
'orderby' => 'meta_value',
'post_type' => 'calendar_holiday',
'meta_query' => array(
array(
'key' => 'over-make',
'value' => 'Doral',
'compare' => 'LIKE'
)
)
);
$query = new WP_Query( $args );