[wp-trac] [WordPress Trac] #20660: wp_get_attachment_url() ignores filter for unrecognized IDs

WordPress Trac noreply at wordpress.org
Tue Aug 20 12:38:50 UTC 2013


#20660: wp_get_attachment_url() ignores filter for unrecognized IDs
-----------------------------+----------------------
 Reporter:  RoamFree         |       Owner:
     Type:  feature request  |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  General          |     Version:  2.1
 Severity:  minor            |  Resolution:  invalid
 Keywords:                   |
-----------------------------+----------------------
Changes (by nacin):

 * status:  reopened => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 It is standard for us to bail early, sans filter, when a function expects
 a post and the post does not exist.

 The filter would receive $post which would be invalid, or it would not be
 passed $post. Either way, all existing usage of the original filter by
 plugins could possibly break. The alternative would be for a new, specific
 filter to be added — solely to be issued when something unexpected
 occurred.

 Your CPT would have a valid ID. But unrecognized post IDs are invalid. One
 should be lucky we are not issuing a WP_Error or throwing an exception.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/20660#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list