$args = array(
'posts_per_page'=>  -1,
'post_type'     =>  'listing',
'meta_query'    =>  array(
                'key'       =>  'ListingRid',
                'value'     =>  $listing_ids,
                'compare'   =>  'IN'
$query = get_posts( $args );

I'm pulling home listings from a remote server and inserting them as custom posts into Wordpress. Only active listings are made available, to update the posts and clear the expired ones I grab an array of all active 'ListingRid' from the server and put them in an array (have also tried a comma separated string) in $listing_ids and compare that array with what I currently have in my Wordpress db, then do a posts__not_in check and delete those posts that it returns.

This snippet works fine on localhost running wamp server. When I run it on my vps (ubuntu) as soon as my script hits this block nothing after it is executed. If I remove the 'posts_per_page' => -1, line it works, but as expected only returns 5 posts when I need it to return ~1,600.

  • 1
    check error logs, you're probably running out of memory if you're trying to load 1600 posts at once. – Milo Jun 24 '13 at 15:26
  • Guess I should have considered that before posting, that's where it's breaking although in both instances it's set to 128M. That's a pretty big number to break, weird it only exceeds that limit on my vps I'll bump it up to 512. – Corey Rowell Jun 24 '13 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.