Ajax::dozent_search_reviews()
Source
File: classes/Ajax.php
public function dozent_search_reviews() { $config = json_decode( wp_unslash( dozent_input_textarea( 'config' ) ), true ); $course_ID = (int) dozent_array_get( 'course_id', $config ); $per_page = (int) dozent_array_get( 'per_page', $config ); $review_s = dozent_input_text( 'review_s' ); $review_s_rating = (int) dozent_input_text( 'review_s_rating' ); if ( ! $course_ID ) { wp_send_json_error(); } $search_args = [ 'course_id' => $course_ID, 'per_page' => $per_page ]; //search term if ( $review_s ) { $search_args['s'] = $review_s; } //Filter by rating if ( $review_s_rating ) { $search_args['rating'] = $review_s_rating; } $reviews_html = dozent_reviews_render( $search_args, false ); wp_send_json_success( [ 'html' => $reviews_html ] ); }