Support » Fixing WordPress » get_posts argument meta_key not working
5 years, 4 months ago
can anyone suggest why the code below is not working, even tho i have a memo (custom post type) with a meta_key of ‘_readbestby_date’ with a numeric value?
$posts = get_posts('post_type=any&meta_key=_readbestby_date&numberposts=-1');
the function containing the code is hooked into the ‘init’ action
side note: the 3.3 beta version im running on my local server doesn’t handle the query either. both versions seem to handle regular posts just fine, but not custom post types.
well for anyone else who stumbles onto this:
it turned out that i was performing the query before my custom post types were being created. changing the priority to a later step fixed my problem.