public
Created

Scriblio plugin/class-facet-taxonomy.php - No matching_post_ids fix

  • Download Gist
gistfile1.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
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 ];
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.