WP_URL_Pattern_Prefixer::__construct( $contexts = array() )

In this article

Constructor.

Parameters

string> $contexts Optional. Map of $context_string => $base_path pairs. Default is the contexts returned by the WP_URL_Pattern_Prefixer::get_default_contexts() method.

Source

public function __construct( array $contexts = array() ) {
	if ( count( $contexts ) > 0 ) {
		$this->contexts = array_map(
			static function ( string $str ): string {
				return self::escape_pattern_string( trailingslashit( $str ) );
			},
			$contexts
		);
	} else {
		$this->contexts = self::get_default_contexts();
	}
}

Changelog

VersionDescription
6.8.0Introduced.

User Contributed Notes

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