Skip to content

Commit

Permalink
Meta Query: get_paid_courses meta_query clause updated
Browse files Browse the repository at this point in the history
Checking course_price meta key exists
  • Loading branch information
shewa12 committed Nov 22, 2024
1 parent a90b032 commit dc9f3d0
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions models/CourseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,9 @@ public function delete_course_data( $post_id ) {
*
* Meta key removed and default meta query updated
*
* @since 3.0.1
* Course::COURSE_PRICE_META meta key exists clause added
*
* @param array $args wp_query args.
*
* @return \WP_Query
Expand All @@ -626,10 +629,16 @@ public static function get_paid_courses( array $args = array() ) {
'posts_per_page' => -1,
'offset' => 0,
'post_status' => 'publish',
'meta_query' => array(
'paid_clause' => array(
'key' => Course::COURSE_PRICE_TYPE_META,
'value' => array( 'paid', 'subscription' ),
'meta_query' => array(
'relation' => 'AND',
array(
'key' => Course::COURSE_PRICE_TYPE_META,
'value' => Course::PRICE_TYPE_SUBSCRIPTION,
'compare' => '!=',
),
array(
'key' => Course::COURSE_PRICE_META,
'compare' => 'EXISTS',
),
),
);
Expand Down

0 comments on commit dc9f3d0

Please sign in to comment.