@@ -12,7 +12,9 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function get( $metaKey, array $args = [] ) |
| 14 | 14 | { |
| 15 | - if( empty( $metaKey ))return; |
|
| 15 | + if( empty( $metaKey )) { |
|
| 16 | + return; |
|
| 17 | + } |
|
| 16 | 18 | |
| 17 | 19 | $args = $this->normalize( $args ); |
| 18 | 20 | $metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] ); |
@@ -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( empty( $vars[$taxonomy] ) || !is_numeric( $vars[$taxonomy] ))continue; |
|
| 54 | + if( empty( $vars[$taxonomy] ) || !is_numeric( $vars[$taxonomy] )) { |
|
| 55 | + continue; |
|
| 56 | + } |
|
| 53 | 57 | $vars[$taxonomy] = get_term_by( 'id', $vars[$taxonomy], $taxonomy )->slug; |
| 54 | 58 | } |
| 55 | 59 | return $query; |
@@ -62,7 +66,9 @@ discard block |
||
| 62 | 66 | { |
| 63 | 67 | global $wp_query; |
| 64 | 68 | foreach( $this->taxonomies as $taxonomy => $args ) { |
| 65 | - if( !in_array( get_current_screen()->post_type, $args['post_types'] ))continue; |
|
| 69 | + if( !in_array( get_current_screen()->post_type, $args['post_types'] )) { |
|
| 70 | + continue; |
|
| 71 | + } |
|
| 66 | 72 | $selected = isset( $wp_query->query[$taxonomy] ) |
| 67 | 73 | ? $wp_query->query[$taxonomy] |
| 68 | 74 | : false; |
@@ -82,7 +88,8 @@ discard block |
||
| 82 | 88 | */ |
| 83 | 89 | public function register() |
| 84 | 90 | { |
| 85 | - array_walk( $this->taxonomies, function( $args, $taxonomy ) { |
|
| 91 | + array_walk( $this->taxonomies, function( $args, $taxonomy ) |
|
| 92 | + { |
|
| 86 | 93 | register_taxonomy( $taxonomy, $args['post_types'], array_diff_key( $args, array_flip( self::CUSTOM_KEYS ))); |
| 87 | 94 | foreach( $args['post_types'] as $type ) { |
| 88 | 95 | register_taxonomy_for_object_type( $taxonomy, $type ); |