attachment_url_to_postid
Filter HookDescription
Filters an attachment ID found by URL.Hook Information
File Location |
wp-includes/media.php
View on GitHub
|
Hook Type | Filter |
Line Number | 5564 |
Hook Parameters
Type | Name | Description |
---|---|---|
int|null
|
$post_id
|
The post_id (if any) found by the function. |
string
|
$url
|
The URL being looked up. |
Usage Examples
Basic Usage
<?php
// Hook into attachment_url_to_postid
add_filter('attachment_url_to_postid', 'my_custom_filter', 10, 2);
function my_custom_filter($post_id, $url) {
// Your custom filtering logic here
return $post_id;
}
Source Code Context
wp-includes/media.php:5564
- How this hook is used in WordPress core
<?php
5559 * @since 4.2.0
5560 *
5561 * @param int|null $post_id The post_id (if any) found by the function.
5562 * @param string $url The URL being looked up.
5563 */
5564 return (int) apply_filters( 'attachment_url_to_postid', $post_id, $url );
5565 }
5566
5567 /**
5568 * Returns the URLs for CSS files used in an iframe-sandbox'd TinyMCE media view.
5569 *
PHP Documentation
<?php
/**
* Filters an attachment ID found by URL.
*
* @since 4.2.0
*
* @param int|null $post_id The post_id (if any) found by the function.
* @param string $url The URL being looked up.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/media.php
Related Hooks
Related hooks will be displayed here in future updates.