• Hello.
    I am developing a custom theme and the problem is the following.
    I have two Custom Post Types created with Custom Post Types UI plugin.
    Each type has Advanced Custom Fields assocciated with it.

    When I now want to query these post types with the following code, the site just keeps loading and I get an fatal error from the max_execution_time.

    $qa = array("post_type"=>array("events","events_special"));
    $query = new WP_Query($qa);
    if( $query->have_posts() ){
     while($query->have_posts() ){
      the_post();
     }
    }

    The site even brakes when I use the normal/standard loop.
    I tried to disable all plugins but the problem is still there.
    Can somone help me plz.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Try:

    $qa = array( “post_type” => array(“events”,”events_special”) );
    $query = new WP_Query( $qa );
    if( $query->have_posts() )
    {
    while( $query->have_posts() ) : $query->the_post();
    // Code here
    endwhile;
    }
    wp_reset_query();

    Thread Starter Levothyroxin

    (@levothyroxin)

    Still not working:

    Fatal error: Maximum execution time of 30 seconds exceeded in
    PATH\wp-includes\query.php on line 749

    If you remove the code you’ve entered does it work or does the problem still exist?

    Thread Starter Levothyroxin

    (@levothyroxin)

    I found a solution.
    I deleted all custom post types an created new ones.
    Now it is working.
    Thank you for your help.
    The actual code is now:

    $qa = array(
        "post_type" => array( "event_standard", "event_special" )
        );
    
    $q = new WP_Query($qa);
    
    if( $q->have_posts() ){
    
        while( $q->have_posts()){
            $q->the_post();
            //more Code here
        } //END WHILE
    
    } //END IF

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WordPress Loop/Query is crashing’ is closed to new replies.