WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
| Line | Code |
|---|---|
| 5517 | * Use the === operator for testing the post ID when developing filters using |
| 5518 | * this hook. |
| 5519 | * |
| 5520 | * @since 6.7.0 |
| 5521 | * |
| 5522 | * @param int|null $post_id The result of the post ID lookup. Null to indicate |
| 5523 | * no lookup has been attempted. Default null. |
| 5524 | * @param string $url The URL being looked up. |
| 5525 | */ |
| 5526 | $post_id = apply_filters( 'pre_attachment_url_to_postid', null, $url ); |
| 5527 | if ( null !== $post_id ) { |
| 5528 | return (int) $post_id; |
| 5529 | } |
| 5530 | |
| 5531 | $dir = wp_get_upload_dir(); |
| 5532 | $path = $url; |
| 5533 | |
| 5534 | $site_url = parse_url( $dir['url'] ); |
| 5535 | $image_path = parse_url( $path ); |