您的当前位置:首页 > 知识博客 > wordpress建站

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

时间:2024-03-09

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

相关函数:

  • wp_attachment_is_image()

  • is_singular()

  • is_single


欢迎咨询/Welcome to inquire
tel/vx:18842938855
qq:1685522781
email:1685522781@qq.com

Copyright © 2019-2024 wangzhan.shop


Whatsapp
Powered by RRZCMS