WordPress at Your Fingertips
function is not described

WC_Template_Loader::force_single_template_filter() public WC 3.3.0

Force the loading of one of the single templates instead of whatever template was about to be loaded.

{} It's a method of the class: WC_Template_Loader{}

No Hooks.

Return

String.

Usage

$result = WC_Template_Loader::force_single_template_filter( $template );
$template(string) (required)
Path to template.

Changelog

Since 3.3.0 Introduced.

Code of WC_Template_Loader::force_single_template_filter() WC 5.7.0

public static function force_single_template_filter( $template ) {
	$possible_templates = array(
		'page',
		'single',
		'singular',
		'index',
	);

	foreach ( $possible_templates as $possible_template ) {
		$path = get_query_template( $possible_template );
		if ( $path ) {
			return $path;
		}
	}

	return $template;
}