Support » Themes and Templates » infinite loop issue – very urgent

infinite loop issue – very urgent

  • Hello there, I am attempting to dynamically create pages for each post in custom type ‘people’, pages are being created like a charm, just every time i refresh the list of the pages the number increases till the admin crashes.. i know it’s a simple solution, but i can’t figure it out.

    here is my code:

    $myPages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'people' AND post_status = 'publish'");
        foreach ($myPages as $q ){
    		$ai_id = $q->ID;
    		$read = array(
    		  'ID'            => 0,
    		  'post_title'    => 'read',
    		  'post_status'   => 'publish',
    		  'post_type'     => 'ailoops',
    		  'post_parent'   =>  $ai_id
    		$readai = wp_update_post( $read );
    			$interviews = array(
    			  'ID'            => 0,
    			  'post_title'    => 'interviews',
    			  'post_status'   => 'publish',
    			  'post_type'     => 'ailoops',
    			  'post_parent'   =>  $readai
    			wp_update_post( $interviews );

    looking forward to your replies

  • The topic ‘infinite loop issue – very urgent’ is closed to new replies.