I've created an admin only page simply to view more information about subscribers to my website. The subscriptions are stored as Custom Post Types.
All I want to do is make a condition that looks up a list of cancelled subscribers and orders them by the expiry of the subscription. The subscription expiry is stored as yyyymmdd as a meta tag on the post.
There are a few pages about this, but I cannot get any solution to work in my instance and it's probably because I'm doing something stupid.
The two I have tried are:
$args=array( 'post_type' => 'subscription', 'post_status' => 'publish', 'meta_key' => 'expiry', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'posts_per_page' => -1, 'caller_get_posts'=> 1, 'meta_query' => array( array( 'key' => 'paypal_recur_profile_status', 'value' => get_post_meta(get_the_ID(),'cancelled',true), 'compare' => '=' ) ), );
$args=array( 'post_type' => 'subscription', 'post_status' => 'publish', 'meta_key' => array('paypal_recur_profile_status', 'expiry'), 'meta_value' => 'Cancelled', 'orderby' => 'expiry' 'order' => 'DESC', 'posts_per_page' => -1, 'caller_get_posts'=> 1, );
The first returns nothing, the second seems to do ok but has some anomalies in it so assume it ends up ordering it by post number and the other correct order results are coincidental.
Can anybody spot the un-deliberate mistake in here or is this simply the wrong way to achieve what I'm trying to do?