LLMS_Question_Manager::get_question( int $id )
Retrieve a question associated with this quiz by question ID
Description Description
Parameters Parameters
- $id
-
(int) (Required) WP Post ID of the question
Return Return
(boolean)
Source Source
File: includes/class.llms.question.manager.php
public function get_question( $id ) { $question = llms_get_post( $id ); // not valid question, return false if ( empty( $question ) || ! is_a( $question, 'LLMS_Question' ) ) { return false; } $parent_id = $question->get( 'parent_id' ); // when parent id is set, only retrieve questions attached to this parent if ( $parent_id && $parent_id !== $this->get_parent()->get( 'id' ) ) { if ( 'llms_question' === $this->get_parent_type() && $this->get_quiz()->get( 'id' ) === $question->get_quiz()->get( 'id' ) ) { return $question; } return false; } // success return $question; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.16.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: