attachment_url_to_postid WordPress Filter Hook

The attachment_url_to_postid hook allows you to override the attachment URL to post ID mapping. This can be useful if you want to use a custom URL for your attachments, or if you want to use an attachment URL from another site.

apply_filters( 'attachment_url_to_postid', int|null $post_id, string $url ) #

Filters an attachment ID found by URL.


Parameters

$post_id

(int|null)The post_id (if any) found by the function.

$url

(string)The URL being looked up.


Top ↑

Source

File: wp-includes/media.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.2.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More