The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] WP_Query Memory problem only on Result-less Queries (2 posts)

  1. I'm writing a plugin and the following query keeps exhausting my memory ONLY when the query should return no results:

    (The two variables are totally fine numeric timestamps.)

    $query_args = array(
    		'post_type' => 'cets_event',
    		'order' => 'ASC',
    		'orderby' => 'meta_value_num',
    		'meta_key' => '_ez_start_date',
    		'meta_query' => array (
    											'key' => '_ez_start_date',
    											'value' => $ts_start_of_month,
    											'compare' => '>',
    											'key' => '_ez_start_date',
    											'value' => $ts_end_of_month,
    											'compare' => '<',
    	$event_query = new WP_Query( $query_args );

    As you can probably guess, it grabs all the events from a given month. It works just fine on any month that has any events created for it, but keeps running out of memory otherwise.

    It _really_ shouldn't be any kind of actual memory issue, as I have 128M available and have not run into a single memory issue before ever.

    The memory runs out from /wp-includes/query.php on line 2941 (the call to get_posts)

    Any ideas?

  2. Update: I think this is likely related to a more advanced component of how this is structured. Hold for more details (or a new thread) :P

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.