[wp-trac] [WordPress Trac] #61383: Add new filter to attachment_url_to_postid() for short circuit

WordPress Trac noreply at wordpress.org
Mon Sep 30 03:17:46 UTC 2024


#61383: Add new filter to attachment_url_to_postid() for short circuit
-------------------------+----------------------------
 Reporter:  apermo       |       Owner:  peterwilsoncc
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:  6.7
Component:  Media        |     Version:
 Severity:  normal       |  Resolution:  fixed
 Keywords:  has-patch    |     Focuses:
-------------------------+----------------------------
Changes (by peterwilsoncc):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"59118" 59118]:
 {{{
 #!CommitTicketReference repository="" revision="59118"
 Media: Add short-circuit filter to `attachment_url_to_postid()`.

 Introduces the filter `pre_attachment_url_to_postid` to allow developers
 to short-circuit the function `attachment_url_to_postid()`.

 The return values are expected to be an attachment ID, zero (`0`) to
 indicate no attachment was found or `null` to indicate the function should
 proceed as usual.

 The function performs an expensive database query so developers making use
 of the function frequently may wish to use a custom table with appropriate
 indexes to reduce the load on their database server.

 Props antpb, apermo, audrasjb, joedolson.
 Fixes #61383.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61383#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list