LLMS_Query::add_endpoints()

Add Query Endpoints


Return Return

(void)


Top ↑

Source Source

File: includes/class.llms.query.php

	public function add_endpoints() {

		foreach ( $this->get_query_vars() as $key => $var ) {
			add_rewrite_endpoint( $var, EP_PAGES, $key );
		}

		global $wp_rewrite;
		foreach ( LLMS_Student_Dashboard::get_tabs() as $id => $tab ) {
			if ( ! empty( $tab['paginate'] ) ) {
				$regex    = sprintf( '(.?.+?)/%1$s/%2$s/?([0-9]{1,})/?$', urldecode( $tab['endpoint'] ), $wp_rewrite->pagination_base );
				$redirect = sprintf( 'index.php?pagename=$matches[1]&%s=$matches[3]&paged=$matches[2]', $id );
				add_rewrite_rule( $regex, $redirect, 'top' );
			}
		}

	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.0.2 Add support for slugs with non-latin characters.
3.28.2 Handle dashboard tab pagination via a rewrite rule.
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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