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 |
---|---|
5417 | * boolean false. For information about casting to booleans see the |
5418 | * {@link https://www.php.net/manual/en/language.types.boolean.php PHP documentation}. |
5419 | * Use the === operator for testing the post ID when developing filters using |
5420 | * this hook. |
5421 | * |
5422 | * @param int|null $post_id The result of the post ID lookup. Null to indicate |
5423 | * no lookup has been attempted. Default null. |
5424 | * @param string $url The URL being looked up. |
5425 | */ |
5426 | $post_id = apply_filters( 'pre_attachment_url_to_postid', null, $url ); |
5427 | if ( null !== $post_id ) { |
5428 | return (int) $post_id; |
5429 | } |
5430 |
|
5431 | $dir = wp_get_upload_dir(); |
5432 | $path = $url; |
5433 |
|
5434 | $site_url = parse_url( $dir['url'] ); |
5435 | $image_path = parse_url( $path ); |