attachment_url_to_postid
Filters an attachment ID found by URL.
Использование
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(строка)
- The URL being looked up.
Список изменений
С версии 4.2.0 | Введена. |
Где вызывается хук
attachment_url_to_postid
wp-includes/media.php 5558
return (int) apply_filters( 'attachment_url_to_postid', $post_id, $url );