Support » Fixing WordPress » get_posts argument meta_key not working

  • Resolved crstauf


    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');

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get_posts argument meta_key not working’ is closed to new replies.