llms_get_page_id( string $page )

Retrieve the WordPress Page ID of a LifterLMS Core Page.


Description Description

Available core pages are:

  • checkout (formerly "shop")
  • courses (Course catalog)
  • myaccount (Student Dashboard)
  • memberships (Membership catalog)

Top ↑

Parameters Parameters

$page

(string) (Required) The page slug/name.


Top ↑

Return Return

(int) The WP_Post ID of the page or -1 if the page is not found.


Top ↑

Source Source

File: includes/functions/llms.functions.page.php

function llms_get_page_id( $page ) {

	// Normalize some pages to make more sense without having to migrate options.
	if ( 'courses' === $page ) {
		$page = 'shop';
	}

	$id = get_option( 'lifterlms_' . $page . '_page_id' );

	/**
	 * Filter the ID of the requested LifterLMS Page.
	 *
	 * The dynamic portion of this filter, {$page}, refers to the LifterLMS page slug/name.
	 *
	 * Note that, historically, the course catalog was called the "shop" and therefore when requesting
	 * the filter will be "lifterlms_get_shop_page_id" instead of "lifterlms_get_courses_page_id".
	 *
	 * @since 1.0.0
	 *
	 * @param int|string $id The WP_Post ID of the requested page or an empty string if the page doesn't exist.
	 */
	$page = apply_filters( "lifterlms_get_{$page}_page_id", $id );

	return $page ? absint( $page ) : -1;

}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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