LLMS_Query::maybe_redirect_certificate()
Redirect requests to old llms_my_certificate URLs to the new url.
Description Description
Redirects /my_certificate/slug
to /certificate/slug
maintaining translations.
This will only redirect if $wp_query
detects a 404 and a certificate exists with the parsed slug. This check is important to prevent against collisions which are theoretically possible, though probably unlikely.
Return Return
(void)
Source Source
File: includes/class.llms.query.php
*/ public function maybe_redirect_certificate() { global $wp, $wp_query; $old = sprintf( '/%s/', _x( 'my_certificate', 'slug', 'lifterlms' ) ); $path = wp_parse_url( home_url( $wp->request ), PHP_URL_PATH ); if ( $wp_query->is_404() && $path && 0 === strpos( $path, $old ) ) { $slug = str_replace( $old, '', $path ); $new_post = get_page_by_path( $slug, 'OBJECT', 'llms_my_certificate' ); if ( $new_post ) { llms_redirect_and_exit( get_permalink( $new_post->ID ) ); } }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
6.0.0 | Introduced. |