Ajax::dozent_search_instructor()
Source
File: classes/Ajax.php
public function dozent_search_instructor() { $search_term = dozent_input_text( 'search_term' ); $course_id = dozent_input_text( 'course_id' ); $course = get_post( $course_id ); $search_args = [ 'search_term' => $search_term, 'start' => 0, 'per_page' => "-1", ]; $attached_instructors_ids = dozent_get_attached_instructors_ids( $course ); $not_in_ids = []; if ( ! empty( $course->post_author ) ) { $not_in_ids[] = $course->post_author; } if ( dozent_count( $attached_instructors_ids ) ) { $not_in_ids = array_merge( $not_in_ids, $attached_instructors_ids ); } if ( dozent_count( $not_in_ids ) ) { $search_args['not_in_ids'] = $not_in_ids; } $instructors = dozent_get_instructors( $search_args ); ob_start(); include_once DOZENT_ABSPATH . '/views/metabox/part/instructors-search-results.php'; $html = ob_get_clean(); wp_send_json_success( [ 'html' => $html ] ); }