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

WordPress根据附件页面地址判断是否为本地附件:is_local_attachment

时间:2024-03-09

WordPress函数is_local_attachment根据附件页面URL判断该附件是否为本地附件,注意这里的URL是附件页面地址,而非附件文件URL。

is_local_attachment( string $url )

函数参数

$url

字符串

附件页面的URL地址

函数使用示例

$url = 'https://www.tiezhushuo.com/3399.html/theme-tiezhushuo';
if(is_local_attachment($url)) {
	//本地附件
} else {
	//远程附件
}

扩展阅读

is_local_attachment()函数位于:wp-includes/post.php

相关函数:

  • is_attachment()

  • home_url()

  • get_post()

  • url_to_postid()


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

Copyright © 2019-2024 mysql.hk


Whatsapp
Powered by RRZCMS