attachment_url_to_postid filter-hookWP 4.2.0

Filters an attachment ID found by URL.

Usage

add_filter( 'attachment_url_to_postid', 'wp_kama_attachment_url_to_postid_filter', 10, 2 );

/**
 * Function for `attachment_url_to_postid` filter-hook.
 * 
 * @param int|null $post_id The post_id (if any) found by the function.
 * @param string   $url     The URL being looked up.
 *
 * @return int|null
 */
function wp_kama_attachment_url_to_postid_filter( $post_id, $url ){

	// filter...
	return $post_id;
}
$post_id(int|null)
The post_id (if any) found by the function.
$url(string)
The URL being looked up.

Changelog

Since 4.2.0 Introduced.

Where the hook is called

attachment_url_to_postid()
attachment_url_to_postid
wp-includes/media.php 5335
return (int) apply_filters( 'attachment_url_to_postid', $post_id, $url );

Where the hook is used in WordPress

Usage not found.