WordPress Query stürzt Browser ab

Ich habe diesen Code unten, der jede untergeordnete Kategorie von einer bestimmten Taxonomie erhält. Es gibt zwei Dinge, mit denen ich Hilfe bekommen möchte:

Refactoring zu WordPress Warum stürzt es ab?

 0) { foreach($customPostTaxonomies as $tax) { $args = array( 'orderby' => 'name', 'show_count' => 0, 'pad_counts' => 0, 'hierarchical' => 1, 'taxonomy' => $tax, 'title_li' => '', 'echo' => false, 'separator'=> ',', 'style' => 'none' ); array_push($categories, wp_list_categories( $args )); } } $mergedArray = ''; foreach($categories as $element) { $mergedArray .= $element; } $mergedArray = explode(',', $mergedArray); $allCategories = []; foreach($mergedArray as $recipesCategory){ $recipesCategory = str_replace('','',$recipesCategory); $recipesCategory = substr($recipesCategory, strpos($recipesCategory, '" >')+3, strlen($recipesCategory)); array_push($allCategories, $recipesCategory); } wp_reset_postdata(); //getting category global $wpdb; foreach($allCategories as $cat){ //geting category data $results = $wpdb->get_results("SELECT * FROM `wp_term_taxonomy` tax JOIN `wp_terms` term on tax.term_id = term.term_id and term.name = '".$cat."' ", OBJECT ); $categoryData = $results[0]; if($categoryData->taxonomy != 'recipe' && $categoryData->taxonomy != 'recipe_category'){ continue; } wp_reset_postdata(); //getting posts by category $the_query = new WP_Query( array( 'tax_query' => array( array( 'taxonomy' => 'recipe', 'terms' => $categoryData->name, 'field' => 'name' ), ), 'posts_per_page' => 12, )); wp_reset_postdata(); } ?> 
have_posts() ) { ?> .... } ?>

Solutions Collecting From Web of "WordPress Query stürzt Browser ab"