llms_redirect_and_exit( string $location, array $options = array() )

Redirect and exit


Description Description

Wrapper for WP core redirects which automatically calls exit();.

This function is redefined when running phpunit tests to make testing code that redirects (and exits).


Top ↑

Parameters Parameters

$location

(string) (Required) Full URL to redirect to.

$options

(array) (Optional) Array of options. Default is empty array.

  • 'status'
    (int) HTTP status code of the redirect. Default: 302.
  • 'safe'
    (bool) If true, use wp_safe_redirect() otherwise use wp_redirect(). Default: true.

Default value: array()


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/functions/llms-functions-wrappers.php

	 */
	function llms_redirect_and_exit( $location, $options = array() ) {

		$options = wp_parse_args(
			$options,
			array(
				'status' => 302,
				'safe'   => true,
			)
		);

		if ( 302 === $options['status'] ) {
			nocache_headers(); // Prevent caching of redirects.
		}



Top ↑

Changelog Changelog

Changelog
Version Description
5.3.0 Moved location from includes/llms.functions.core.php.
3.19.4 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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