Definition:
function is_local_attachment($url) {}
Check if the attachment URI is local one and is really an attachment.
Parameters
- string $url: URL to check
Return values
returns:True on success, false on failure.
Source code
function is_local_attachment($url) {
if (strpos($url, home_url()) === false)
return false;
if (strpos($url, home_url('/?attachment_id=')) !== false)
return true;
if ( $id = url_to_postid($url) ) {
$post = & get_post($id);
if ( 'attachment' == $post->post_type )
return true;
}
return false;
}
2131

February 12, 2011 


No comments yet... Be the first to leave a reply!