| @@ -344,8 +344,12 @@ | ||
| 344 | 344 | return $posts; |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | // Check screen |
| 348 | + if ( ! function_exists( 'get_current_screen' ) ) { | |
| 349 | + return $posts; | |
| 350 | + } | |
| 351 | + | |
| 348 | 352 | $curren_screen = get_current_screen(); |
| 349 | 353 | if ( ! $curren_screen || $curren_screen->id !== 'edit-' . LP_QUESTION_CPT ) { |
| 350 | 354 | return $posts; |
| 351 | 355 | } |
| @@ -372,9 +376,15 @@ | ||
| 372 | 376 | |
| 373 | 377 | $filter = new QuestionPostFilter(); |
| 374 | 378 | $filter->page = $paged; |
| 375 | 379 | $filter->limit = $posts_per_page; |
| 376 | - $filter->only_fields = [ 'p.ID', 'p.post_title', 'p.post_author', 'p.post_date', 'p.post_date_gmt' ]; | |
| 380 | + $filter->only_fields = array_map( | |
| 381 | + function ( $field ) { | |
| 382 | + return "p.{$field}"; | |
| 383 | + }, | |
| 384 | + $filter->all_fields | |
| 385 | + ); | |
| 386 | + $filter->field_count = 'p.ID'; | |
| 377 | 387 | $post_db = PostDB::getInstance(); |
| 378 | 388 | |
| 379 | 389 | if ( ! empty( $status ) ) { |
| 380 | 390 | $filter->post_status = array( $status ); |