Skip to content

Instantly share code, notes, and snippets.

@michael-cannon
Created July 1, 2012 16:06
Show Gist options
  • Save michael-cannon/3028827 to your computer and use it in GitHub Desktop.
Save michael-cannon/3028827 to your computer and use it in GitHub Desktop.
Scriblio plugin/class-facet-taxonomy.php - No matching_post_ids fix
Index: plugin/class-facet-taxonomy.php
===================================================================
--- plugin/class-facet-taxonomy.php (revision 566010)
+++ plugin/class-facet-taxonomy.php (working copy)
@@ -89,7 +89,7 @@
$cache_key = md5( serialize( $matching_post_ids ));
- if( ! $this->facets->_matching_tax_facets = wp_cache_get( $cache_key , 'scrib-facet-taxonomy' ))
+ if( ! empty( $matching_post_ids ) && ! $this->facets->_matching_tax_facets = wp_cache_get( $cache_key , 'scrib-facet-taxonomy' ))
{
global $wpdb;
@@ -115,10 +115,14 @@
'term_taxonomy_id' => $term->term_taxonomy_id,
);
}
-
- wp_cache_set( $cache_key, $this->facets->_matching_tax_facets , 'scrib-facet-taxonomy', $this->ttl );
}
+ else
+ {
+ $this->facets->_matching_tax_facets = array();
+ }
+ wp_cache_set( $cache_key, $this->facets->_matching_tax_facets , 'scrib-facet-taxonomy', $this->ttl );
+
return $this->facets->_matching_tax_facets[ $this->name ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment