llms_is_post_restricted_by_membership( int $post_id, int|null $user_id = null )
Determine if a WordPress post (of any type) is restricted to at least one LifterLMS Membership level.
Description Description
This function replaces the now deprecated page_restricted_by_membership() (and has slightly different functionality).
Parameters Parameters
- $post_id
-
(Required) WP_Post ID.
- $user_id
-
(Optional) WP User ID (will use get_current_user_id() if none supplied). Default
null
.Default value: null
Return Return
(bool|int) WP_Post ID of the membership if a restriction is found. False if no restrictions found.
Source Source
File: includes/functions/llms.functions.access.php
Changelog Changelog
Version | Description |
---|---|
3.37.10 | Call in_array() with strict comparison. |
3.16.14 | Unknown. |
3.0.0 | Introduced. |