• I’m using this query:

    <?php $featured = new WP_Query(); ?>
    <?php $featured->query('post_type=page&custom-write-panel-id=2&child_of=' . $id); ?>

    All it ever returns is my “Sitemap” page, which is not a child of $id, and is not a write panel. What am I missing?

Viewing 6 replies - 1 through 6 (of 6 total)
  • What’s custom-write-panel-id supposed to refer to?

    Thread Starter Jorenm

    (@jorenm)

    I’m using Magic Fields which lets you create custom post types called Write Panels. It doesn’t respect the child_of parameter even if I take out the custom-write-panel-id part.

    Where are you getting $id from?

    Thread Starter Jorenm

    (@jorenm)

    The $id is set in the loop. I’ve echo’d it and it is the ID of the page I’m on.

    Try using $post->ID

    Because it’s meta data, you can’t query it using ‘custom-write-panel-id’. Instead, try this:

    <?php $featured = new WP_Query(); ?>
    <?php $featured->query('_mf_write_panel_id=1'); ?>

    You can look in the database table wp-postmeta to find any column names you want to query on.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WP_Query not returning what I'd expect.’ is closed to new replies.