Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_strip_template_file_suffix() WordPress Function

This function strips the template file suffix from a given filename. It is useful for removing the ".php" extension from template filenames so that they can be used with the WordPress Template Hierarchy.

_strip_template_file_suffix( string $template_file ) #

Strips .php or .html suffix from template file names.


Parameters

$template_file

(string)(Required)Template file name.


Top ↑

Return

(string) Template file name without extension.


Top ↑

Source

File: wp-includes/block-template.php

function _strip_template_file_suffix( $template_file ) {
	return preg_replace( '/\.(php|html)$/', '', $template_file );
}

Top ↑

Changelog

Changelog
VersionDescription
5.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.