时间: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()
Copyright © 2019-2024 liangfang.net