3
Array
(
    [post_parent] => 101
    [post_type] => page
    [posts_per_page] => -1
    [orderby] => title
    [order] => asc
    [meta_query] => Array
        (
            [0] => Array
                (
                    [key] => rank
                    [value] => Assistant Professor
                )

            [1] => Array
                (
                    [key] => profession
                    [value] => Radiation Oncology
                )

        )

)

This looks right to me. But it's not working! ... Answer?? WP3.1 RC3

3
  • 5
    Could you post a dump of the final SQL generated by WP_Query? Easiest way would be by installing the Debug Bar plugin. Or just var_dump($wp_query->request)
    – scribu
    Feb 4, 2011 at 17:58
  • 1
    Those query params look okay. Are you absolutely certain that you have a page that matches those criteria exactly? Feb 24, 2011 at 21:28
  • how's this going? Found an answer yet? Apr 29, 2011 at 1:24

1 Answer 1

1

I'm not familiar with the exact way you're doing it. I'm more familiar with the format that Scribu outlines on his blog.

I'd say you should at least be using quote marks on 'rank' and 'Assistant Professor', but there could be more to it.

If that's not working out, you could go old school and use a pre 3.1 solution, such as the one I outlined on the WordPress.org Support forum. That's using an SQL statement with aliases to find posts based on 4 Custom Fields.

It was posted a couple of years ago, so you might want to revise that for security - it should probably be using the prepare command for a start - but the basic concept should still work.

1
  • I'm pretty sure he copied a var_dump() of the query vars, since commas and all quote marks are missing. Also, the method you used in that answer is what WordPress does now. I think the questions above need to be answered before any sort of attempt is made at answering the question. Apr 29, 2011 at 1:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.