So, I’m trying to do multiple loops on one page. This is (usually) easily done using WP_Query() as follows:
$my_query = new WP_Query('post_name=about&post_type=page&showposts=1');
No problem, in theory. In fact, this very thing has been working fine in multiple places for me.
However, it would seem that this functionality is somewhat broken in the current version of wordpress. In any case, the data that these loops bring back isn’t correct. It doesn’t seem to parse post_name into the query string. I expect the above query to be parsed something like this:
SELECT * FROM wp_posts WHERE post_name = 'about' AND post_type = 'page' COUNT 1
Instead, every instance of WP_Query returns exactly the same data. It ignores the first term, and returns all of the posts marked as pages. If I remove that term, it returns all of the posts.
It’s driving me mad. Anybody got any ideas?
- The topic ‘Multiple loops using WP_Query()’ is closed to new replies.