llms_get_endpoint_url( string $endpoint, string $value = '', string $permalink = '' )
Retrieve the full URL to a LifterLMS endpoint
Description Description
Parameters Parameters
- $endpoint
-
(string) (Required) ID of the endpoint, eg "view-courses"
- $value
-
(string) (Optional)
Default value: ''
- $permalink
-
(string) (Optional) base URL to append the endpoint to
Default value: ''
Return Return
(string)
Source Source
File: includes/functions/llms.functions.page.php
function llms_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) { if ( ! $permalink ) { $permalink = get_permalink(); } // Map endpoint to options $vars = LLMS()->query->get_query_vars(); $endpoint = isset( $vars[ $endpoint ] ) ? $vars[ $endpoint ] : $endpoint; if ( get_option( 'permalink_structure' ) ) { if ( strstr( $permalink, '?' ) ) { $query_string = '?' . parse_url( $permalink, PHP_URL_QUERY ); $permalink = current( explode( '?', $permalink ) ); } else { $query_string = ''; } $url = trailingslashit( $permalink ) . $endpoint . '/' . $value . $query_string; } else { $url = add_query_arg( $endpoint, $value, $permalink ); } return apply_filters( 'lifterlms_get_endpoint_url', $url, $endpoint ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: