• Hi. I am having some trouble getting limit= to work in one of my wordpress installs. I am using the code below in one install and it works fine. In another install, though, it doesn’t. I have deactivated plugins and tested it and it still doesn’t work, so my question is is there a loophole in the code below that would cause limit= to not work in some situations and if not, what would be a possible next step for debugging this? Where else might the interference be coming from?

    This code is in category.php.

    If (is_category('Blog')) {
    	$q = "cat=" . get_cat_ID('Blog');
    	$postQuery = new WP_Query();
    	$postQuery->query($q);
    	}
    
         else {
    	$cat = get_cat_id( single_cat_title("",false) );
    	$q="meta_key=event_date&cat=".$cat."&orderby=event_date&order=asc&limit=50";
    	$postQuery = new WP_Query();
            $postQuery->query($q);
    	}
    
         while ($postQuery->have_posts()) : $postQuery->the_post();
         //do stuff
  • The topic ‘Quirky Behavior When Using limit= in Loop’ is closed to new replies.