WordPress判断是否附件页面函数:is_attachment

WordPress函数is_attachment用于判断当前页面是否为附件页。

is_attachment( int|string|int[]|string[] $attachment = '' )

函数参数

$attachment

字符串、整数或数组

附件的ID、别名或标题

函数使用示例

if(is_attachment(3645)) {
	//当前页面附件页面,且该附件的ID为3645
} else {
	
}

扩展阅读

is_attachment()函数位于:wp-includes/query.php

相关函数:

原创文章,作者:,如若转载,请注明出处:https://ce.771633.xyz/1876.html

Like (0)
Previous 2025年3月8日
Next 2025年3月8日

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注