Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I created a custom-post-type for members of a firm. On the start-page I tried to call them via custom query but it shows an error. Heres my code: and the error says: Call to a member function get_queried_object() on a non-object in /www/htdocs/w00e3b6a/hosting/basecamp/wp-includes/query.php on line 43

What did I wrong with the query?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

just use


instead of

$wp_query = new WP_Query( array(
                    'post_type' => 'team-member',
                    'posts_per_page' => 2,
                    ) );

and then the while loop as

if(have_posts()) while(have_posts()) : the_post();

instead of

<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
share|improve this answer

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.