_strip_template_file_suffix

函数
_strip_template_file_suffix ( $template_file )
Access
Private
参数
  • (string) $template_file Template file name.
    Required:
返回值
  • (string) Template file name without extension.
定义位置
相关方法
_get_block_templates_fileswp_scripts_get_suffix_get_block_template_fileget_theme_file_uriget_template_directory_uri
引入
5.8.0
弃用
-

_strip_template_file_suffix: 这个函数用来从模板的文件名中删除后缀。这个后缀通常被添加到模板文件名的末尾,以表明模板的类型(例如,页面、单个文章等): 这个函数用来检索没有这个后缀的模板名称,这在注册自定义模板时很有用。

从模板文件名中删除.php或.html后缀。

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

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2026-03-15 14:37:20

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: