1/**
2 * Return an array of post IDs
3 *
4 * Build a more efficient query by only returning an array of post IDs.
5 *
6 * @author David Egan
7 * @return array Array of post IDs
8 * @see http://codex.wordpress.org/Class_Reference/WP_Query#Return_Fields_Parameter
9 */
10function carawebs_student_questionnaire_results(){
11
12 $args = array(
13 'post_type' => 'questionnaire-result',
14 'post_status' => 'publish',
15 'fields' => 'ids',
16 'meta_query' => array(
17 array(
18 'key' => 'user_type',
19 'value' => 'student',
20 'compare' => '=',
21 'type' => 'CHAR',
22 ),
23 ),
24 );
25
26 // The Query
27 $result_query = new WP_Query( $args );
28
29 $ID_array = $result_query->posts;
30
31 // Restore original Post Data
32 wp_reset_postdata();
33
34 return $ID_array;
35
36}