Skip to content

Commit

Permalink
Don't run the filters for categories if the $comiccat is not a parent…
Browse files Browse the repository at this point in the history
… category; this will stop it freezing the site up on updates
  • Loading branch information
Frumph committed May 19, 2013
1 parent de3fc98 commit c2e7251
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ function comicpress_in_comic_category($cat = null) {
*/
function comicpress_create_category_tree() {
global $category_tree, $comiccat;
$comiccat_check = get_category($comiccat);
if (is_null($comiccat_check) || $comiccat_check->category_parent > 0) return array(); // Return empty array if the comiccat isn't a parent.
if (empty($category_tree)) {
$categories_by_id = comicpress_get_comic_category_objects_by_id();
if (empty($categories_by_id) || !is_array($categories_by_id)) return false;
Expand Down Expand Up @@ -346,15 +348,6 @@ function comicpress_create_category_tree() {
return $category_tree;
}

function comicpress_vardump_info() {
global $vardumpinfo;
echo '<div class="error">';
echo $vardumpinfo;
echo '</div>';
}

// if (is_admin()) add_action( 'admin_notices', 'comicpress_vardump_info' );

function comicpress_create_comic_category_tree() {
$categories_by_id = comicpress_get_comic_category_objects_by_id();
foreach (array_keys($categories_by_id) as $category_id) {
Expand Down Expand Up @@ -578,6 +571,8 @@ function comicpress_get_comic_category_objects_by_id() {
// This uses the comicpress_load_config() because it's not yet triggered in themeinfo
function comicpress_all_comic_categories_array() {
global $comiccat, $comicpress_all_comic_categories_array;
$comiccat_check = get_category($comiccat);
if (is_null($comiccat_check) || $comiccat_check->category_parent > 0) return array(); // Return if the comiccat isn't a parent.
if (empty($comicpress_all_comic_categories_array)) {
$comicpress_all_comic_categories_array[] = $comiccat;
foreach (get_all_category_ids() as $cats) {
Expand Down

0 comments on commit c2e7251

Please sign in to comment.