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

I've been puzzling over this one for two days. Still can't figure it out.

I'm testing a theme release in multiple versions of WordPress using xampplite on localhost on a PC.

I'm having a problem on WP 2.9.2 that does not occur on any other newer installations of WP.

Take a look at the query below. As long as I leave the commented line in place, it works fine. However, when I uncomment the line, it crashes my xampplite Apache server. WTF?

$the_query = new WP_Query(array(
  'posts_per_page' => 5,
  'offset' => 0, 
  'order' => 'ASC',
  'post__not_in' => get_option("sticky_posts"),
//  'cat' => get_cat_ID('top-menu'),
print "<p>header.php";exit;

I've even tried to hard code the cat attribute to a static number:

'cat' => 3

It still crashes!

Is this a problem with the code, wordpress 2.9.2 or with my Xamplite setup? Seems odd that it works in all newer other versions of WP I've got set up on this same box.

share|improve this question
remove the thrilling comma after get_cat_ID('top-menu') . – Bainternet Feb 9 '11 at 22:04
Done! Still crashes :( – Scott B Feb 9 '11 at 22:08
Your server crash might be related to the configuration you've running on your local box. See: “Apache HTTP Service has stopped working” with WP Query in WordPress 2.9.2 – hakre Feb 9 '11 at 22:18
Is the cat ID for 'top-menu' 2.2250738585072011e-308 by any chance? j/k: theregister.co.uk/2011/01/04/weird_php_dos_vuln – goldenapples Feb 9 '11 at 22:49
@hakre: its looking more like a server config issue that just happens to be weakened by WP2.9.2 somehow. – Scott B Feb 9 '11 at 23:32
up vote 1 down vote accepted

The only thing I see as even close to syntactically questionable is that showposts could be replaced with posts_per_page.

share|improve this answer
Thanks for the input editor. It works fine with either. The only problem it has is when the cat argument is present. I'm burning two days on tracking this down, argggh! – Scott B Feb 9 '11 at 22:03
The former, but really I'm sort of reaching. It looks like WP will set $query['posts_per_page'] to $query['showposts'] in &get_posts() function, in both 2.9 and 3.0 (core.trac.wordpress.org/browser/tags/3.0.5/wp-includes/…). I think that's all the query vars listed in fill_query_vars(). – editor Feb 9 '11 at 22:08

Realise this old now, but this may help people finding this via Google:

I had problems with Apache dying when running similar code within a function called by the pre_get_posts hook. Problem was I missed the conditional:


meaning it was doing work for all the queries, not just the main one. Adding that fixed the problem for me. The full conditional I use is (then other code above below that:

if ( ! is_category() || ! $query->is_main_query() || ! is_a( $query, 'WP_Query' ) )
share|improve this answer
is_main_query() didn’t even exist in 2.9.2. That cannot be a valid answer. – toscho Jun 30 '12 at 13:13

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.