Quantcast
Channel: Question and Answer » meta-query
Viewing all articles
Browse latest Browse all 36

get posts by meta_key from inside key of post meta

$
0
0

How can i get posts sorted out by meta_key from inner key array of post meta values, for more details please look at my code:

// Example output of each post_meta, key is views

array(
    'all' => '334',
    'new' = '28',
    'old' => '280'
)

// wp_query with meta_query not working with above meta_key 

$popular = new WP_Query( array(
    'post_type'             => 'songs',
    'showposts'             => '20',
    'order'                 => 'DSC',
    'meta_key'              => 'views', // i want something like this views['all']
    'orderby'               => 'meta_value_num'
) );

Viewing all articles
Browse latest Browse all 36

Trending Articles