| @@ -123,8 +123,12 @@ | ||
| 123 | 123 | return $posts; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | // Check screen |
| 127 | + if ( ! function_exists( 'get_current_screen' ) ) { | |
| 128 | + return $posts; | |
| 129 | + } | |
| 130 | + | |
| 127 | 131 | $curren_screen = get_current_screen(); |
| 128 | 132 | if ( ! $curren_screen || $curren_screen->id !== 'edit-' . LP_LESSON_CPT ) { |
| 129 | 133 | return $posts; |
| 130 | 134 | } |
| @@ -151,9 +155,15 @@ | ||
| 151 | 155 | |
| 152 | 156 | $filter = new LessonPostFilter(); |
| 153 | 157 | $filter->page = $paged; |
| 154 | 158 | $filter->limit = $posts_per_page; |
| 155 | - $filter->only_fields = [ 'p.ID', 'p.post_title', 'p.post_author', 'p.post_date', 'p.post_date_gmt' ]; | |
| 159 | + $filter->only_fields = array_map( | |
| 160 | + function ( $field ) { | |
| 161 | + return "p.{$field}"; | |
| 162 | + }, | |
| 163 | + $filter->all_fields | |
| 164 | + ); | |
| 165 | + $filter->field_count = 'p.ID'; | |
| 156 | 166 | $post_db = PostDB::getInstance(); |
| 157 | 167 | |
| 158 | 168 | if ( ! empty( $status ) ) { |
| 159 | 169 | $filter->post_status = array( $status ); |