WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Working on updating an old WP site developed for WordPress 2.0 and have a post (page) query that does not return the "post_content" data.

Here is said query:

$the_query = query_posts('post_type=page&post_parent=50&post_status=publish&orderby=menu_order&order=ASC&posts_per_page=100');

And the returned object (one of them):

[0] => stdClass Object
        [ID] => 249
        [post_title] => John Doe
        [link_link] => 1
        [no_follow_link] => 0
        [redirect_url] => 
        [target_blank] => 0
        [post_status] => publish
        [post_name] => john-do
        [post_parent] => 50
        [guid] => http://beta.mysite.org/
        [post_type] => page
        [filter] => raw

Notably this is missing the post_content. Which is kind of a big deal. Any ideas? I don't think it's a memory limit issue. I've tried many different work-arounds. Suggestions are much appreciated.

share|improve this question
See if this answer could help – amit Aug 10 '12 at 16:13
disable all plugins, to see if any of them is messing up with the content filter. – pixeline Aug 11 '12 at 22:35

You shouldn't be using query_posts() here, but rather WP_Query(). (Search WPSE for query_posts if you want to know wy.)

$custom_query_args = array( 
    'post_type' => 'page',
    'post_parent' => '50',
    'post_status' => 'publish',
    'orderby' => 'menu_order',
    'order' => 'ASC',
    'posts_per_page' => '100'
$custom_query = new WP_Query( $custom_query_args );

// To see the contents of the $custom_query object
var_dump( $custom_query );


No dice. Same result.

The query is returning exactly what it is intended to return. In order to access the $post data, you need to set up the Loop:

if ( $custom_query->have_posts() ) : while ( $custom_query->have_posts() ) : $custom_query->the_post() );

    // The $post variable is now available, 
    // so you can access the post content, either as
    // $post->post_content or as the_content()

endwhile; endif;

So, I'm guessing your problem is that you're not setting up the Loop.

share|improve this answer
No dice. Same result. – Brian Notess Aug 11 '12 at 1:59
What, exactly, does the var_dump() return? – Chip Bennett Aug 11 '12 at 15:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.