@@ -46,10 +46,14 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function filterBy( WP_Query $query ) |
| 48 | 48 | { |
| 49 | - if( !is_admin() || get_current_screen()->base != 'edit' )return; |
|
| 49 | + if( !is_admin() || get_current_screen()->base != 'edit' ) { |
|
| 50 | + return; |
|
| 51 | + } |
|
| 50 | 52 | $vars = &$query->query_vars; |
| 51 | 53 | foreach( array_keys( $this->taxonomies ) as $taxonomy ) { |
| 52 | - if( !isset( $vars[$taxonomy] ))return; |
|
| 54 | + if( !isset( $vars[$taxonomy] )) { |
|
| 55 | + return; |
|
| 56 | + } |
|
| 53 | 57 | if( $term = get_term_by( 'id', $vars[$taxonomy], $taxonomy )) { |
| 54 | 58 | $vars[$taxonomy] = $term->slug; |
| 55 | 59 | } |
@@ -64,7 +68,9 @@ discard block |
||
| 64 | 68 | { |
| 65 | 69 | global $wp_query; |
| 66 | 70 | foreach( $this->taxonomies as $taxonomy => $args ) { |
| 67 | - if( !in_array( get_current_screen()->post_type, $args['post_types'] ))continue; |
|
| 71 | + if( !in_array( get_current_screen()->post_type, $args['post_types'] )) { |
|
| 72 | + continue; |
|
| 73 | + } |
|
| 68 | 74 | $selected = isset( $wp_query->query[$taxonomy] ) |
| 69 | 75 | ? $wp_query->query[$taxonomy] |
| 70 | 76 | : false; |
@@ -84,7 +90,8 @@ discard block |
||
| 84 | 90 | */ |
| 85 | 91 | public function register() |
| 86 | 92 | { |
| 87 | - array_walk( $this->taxonomies, function( $args, $taxonomy ) { |
|
| 93 | + array_walk( $this->taxonomies, function( $args, $taxonomy ) |
|
| 94 | + { |
|
| 88 | 95 | register_taxonomy( $taxonomy, $args['post_types'], array_diff_key( $args, array_flip( self::CUSTOM_KEYS ))); |
| 89 | 96 | foreach( $args['post_types'] as $type ) { |
| 90 | 97 | register_taxonomy_for_object_type( $taxonomy, $type ); |