PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 All 140 releases
← All changes | inc/custom-post-types/course.php +16 -5 4.4.8 → 4.4.9 View file →
@@ -215,9 +215,9 @@
215 215 *
216 216 * @param array $posts
217 217 * @param WP_Query $wp_query
218 218 *
219 - * @return array|WP_Query
219 + * @return array
220 220 * @since 4.4.8
221 221 * @version 1.0.0
222 222 */
223 223 public function posts_pre_query( $posts, $wp_query ) {
@@ -226,8 +226,12 @@
226 226 return $posts;
227 227 }
228 228
229 229 // Check screen
230 + if ( ! function_exists( 'get_current_screen' ) ) {
231 + return $posts;
232 + }
233 +
230 234 $curren_screen = get_current_screen();
231 235 if ( ! $curren_screen || $curren_screen->id !== 'edit-' . LP_COURSE_CPT ) {
232 236 return $posts;
233 237 }
@@ -252,12 +256,19 @@
252 256 $orderby = LP_Request::get_param( 'orderby', '', 'key' );
253 257 $order = LP_Request::get_param( 'order', '', 'key' );
254 258 $filter_price = LP_Helper::sanitize_params_submitted( $_REQUEST['filter_price'] ?? '' );
255 259
256 - $filter = new CoursePostFilter();
257 - $filter->page = $paged;
258 - $filter->limit = $posts_per_page;
259 - $post_db = PostDB::getInstance();
260 + $filter = new CoursePostFilter();
261 + $filter->page = $paged;
262 + $filter->limit = $posts_per_page;
263 + $filter->only_fields = array_map(
264 + function ( $field ) {
265 + return "p.{$field}";
266 + },
267 + $filter->all_fields
268 + );
269 + $filter->field_count = 'p.ID';
270 + $post_db = PostDB::getInstance();
260 271
261 272 if ( ! empty( $status ) ) {
262 273 $filter->post_status = array( $status );
263 274 }