LLMS_Question_Manager::get_questions( string $return = 'questions' )
Get questions
Parameters Parameters
- $return
-
(string) (Optional) type of return [ids|posts|questions]
Default value: 'questions'
Return Return
(array)
Source Source
File: includes/class.llms.question.manager.php
public function get_questions( $return = 'questions' ) {
$query = new WP_Query(
array(
'meta_query' => array(
array(
'key' => '_llms_parent_id',
'value' => $this->get_parent()->get( 'id' ),
),
),
'order' => 'ASC',
'orderby' => 'menu_order',
'post_status' => 'publish',
'post_type' => 'llms_question',
'posts_per_page' => 500,
)
);
if ( 'ids' === $return ) {
$ret = wp_list_pluck( $query->posts, 'ID' );
} elseif ( 'posts' === $return ) {
$ret = $query->posts;
} else {
$ret = array();
foreach ( $query->posts as $post ) {
$ret[] = new LLMS_Question( $post );
}
}
return apply_filters( 'llms_quiz_get_questions', $ret, $this, $return );
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.3.0 | Introduced. |