| @@ -1,9 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace WPDeveloper\BetterDocs\Admin; |
| 3 | 3 | |
| 4 | -use Error; | |
| 5 | - | |
| 6 | 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | 5 | exit; // Exit if accessed directly. |
| 8 | 6 | } |
| 9 | 7 | |
| @@ -119,23 +117,16 @@ | ||
| 119 | 117 | ); |
| 120 | 118 | } |
| 121 | 119 | } elseif ( isset( $this->args['kb_terms'] ) ) { |
| 122 | 120 | $join = "INNER JOIN {$this->wpdb->term_relationships} ON ({$this->wpdb->posts}.ID = {$this->wpdb->term_relationships}.object_id)"; |
| 123 | - $kb_terms = []; | |
| 124 | - | |
| 125 | 121 | foreach ( $this->args['kb_terms'] as $term_slug ) { |
| 126 | 122 | $term = get_term_by( 'slug', $term_slug, 'knowledge_base' ); |
| 127 | 123 | if ( $term ) { |
| 128 | - $kb_terms[] = $term->term_taxonomy_id; | |
| 124 | + $where .= $this->wpdb->prepare( | |
| 125 | + " AND {$this->wpdb->term_relationships}.term_taxonomy_id = %d", | |
| 126 | + $term->term_taxonomy_id | |
| 127 | + ); | |
| 129 | 128 | } |
| 130 | - } | |
| 131 | - | |
| 132 | - if ( ! empty( $kb_terms ) ) { | |
| 133 | - $term_placeholder = implode( ', ', array_fill( 0, count( $kb_terms ), '%d' ) ); | |
| 134 | - $where .= $this->wpdb->prepare( | |
| 135 | - " AND {$this->wpdb->term_relationships}.term_taxonomy_id IN ($term_placeholder)", | |
| 136 | - $kb_terms | |
| 137 | - ); | |
| 138 | 129 | } |
| 139 | 130 | } |
| 140 | 131 | |
| 141 | 132 | if ( $this->args['author'] ) { |