WC_Template_Loader::force_single_template_filter( string $template )

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


Description Description


Parameters Parameters

$template

(Required) Path to template.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/class-wc-template-loader.php

	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;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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