[wp-trac] [WordPress Trac] #16830: url_to_postid() doesn't resolve attachments when rewrite rules are disabled

WordPress Trac wp-trac at lists.automattic.com
Thu Mar 17 14:21:18 UTC 2011


#16830: url_to_postid() doesn't resolve attachments when rewrite rules are disabled
---------------------------+------------------------------
 Reporter:  Coolkevman     |       Owner:
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Rewrite Rules  |     Version:  3.1
 Severity:  normal         |  Resolution:
 Keywords:                 |
---------------------------+------------------------------

Comment (by Coolkevman):

 Also, [http://wordpress.org/support/topic/need-to-get-attachment-id-by-
 image-url#post-1994690 as discussed in the forum], we may consider to
 distinguish:
  * image URLs (like {{{http://domain.com/wp-content/uploads/month/year
 /attachment-filename.jpg}}}) and
  * attachment URLs (like {{{http://domain.com/year/month/post-slug
 /attachment-slug/}}})
 as two different classes of content. With this hypothesis in mind, we can
 then decide that image URLs are not meant to be translated to post IDs by
 {{{url_to_postid()}}}. In which case this bug report can be closed as
 invalid.

 But I quite disagree with this idea of distinguishing these two classes of
 URLs. Why ? Look at a method like {{{wp_get_attachment_url()}}}. It
 returns what I called above an "image URL". Yet the method is named with
 the "attachment" keyword. To me this indicate either:
  * a framework inconsistency (which should be solved by renaming these
 kind of methods),
  * or that my bug report is valid and that {{{url_to_postid()}}} should be
 able to resolve what I called "image URLs".

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


More information about the wp-trac mailing list