LLMS_Question_Manager::get_questions( string $return = 'questions' )

Get questions


Description Description


Parameters Parameters

$return

(string) (Optional) type of return [ids|posts|questions]

Default value: 'questions'


Top ↑

Return Return

(array)


Top ↑

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 );

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.3.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.