llms_get_post( WP_Post|int $post, mixed $error = false )

Retrieve the LLMS Post Model for a give post by ID or WP_Post Object


Parameters Parameters

$post

(WP_Post|int) (Required) Instance of WP_Post or a WP Post ID.

$error

(mixed) (Optional) Determine what to return if the LLMS class isn't found. post = WP_Post falsy = false.

Default value: false


Top ↑

Return Return

(LLMS_Post_Model|WP_Post|null|false) LLMS_Post_Model extended object, null if WP get_post() fails, WP_Post if LLMS_Post_Model extended class isn't found and $error = 'post' false if LLMS_Post_Model extended class isn't found and $error != 'post'.


Top ↑

Source Source

File: includes/llms.functions.core.php

	 * Filter the course children post types
	 *
	 * @since Unknown
	 *
	 * @param $post_type string[] Names of the post types that can be children of a course.
	 */
	$post_types = apply_filters( 'llms_course_children_post_types', array( 'section', 'lesson', 'llms_quiz' ) );
	if ( ! in_array( $post->get( 'type' ), $post_types, true ) ) {
		return null;
	}

	/** @var LLMS_Section|LLMS_Lesson|LLMS_Quiz $post */
	return $post->get_course();

}


/**
 * Retrieve an array of existing transaction statuses
 *
 * @since 3.0.0
 *
 * @return array
 */
function llms_get_transaction_statuses() {
	/**
	 * Filter the transaction statuses


Top ↑

Changelog Changelog

Changelog
Version Description
4.10.1 Made sure to only instantiate LifterLMS classes.
3.3.0
3.16.11 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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