Skip to content

Commit

Permalink
Only loop if terms is an array
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsternberg committed Mar 30, 2016
1 parent 7c0d4d4 commit e9012f1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions conditional-display/show-for-taxonomy-terms.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@ function be_taxonomy_show_on_filter( $cmb ) {
? get_the_terms( $post, $taxonomy )
: wp_get_object_terms( $post_id, $taxonomy );

foreach( $terms as $term ) {
if ( in_array( $term->slug, $slugs, true ) ) {
// Ok, show this metabox
return true;
if ( ! empty( $terms ) ) {
foreach( $terms as $term ) {
if ( in_array( $term->slug, $slugs, true ) ) {
wp_die( '<xmp>: '. print_r( 'show it', true ) .'</xmp>' );
// Ok, show this metabox
return true;
}
}
}
}

return false;
}

0 comments on commit e9012f1

Please sign in to comment.