LLMS_Question_Manager::get_question( int $id )
Retrieve a question associated with this quiz by question ID
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. |