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

WordPress Trac noreply at wordpress.org
Sun Aug 18 15:45:22 UTC 2013


#16830: url_to_postid() doesn't resolve attachments when rewrite rules are disabled
-----------------------------+------------------------------
 Reporter:  Coolkevman       |       Owner:
     Type:  feature request  |      Status:  reopened
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Rewrite Rules    |     Version:  1.2
 Severity:  normal           |  Resolution:
 Keywords:  has-patch        |
-----------------------------+------------------------------

Comment (by MikeSchinkel):

 Replying to [comment:9 c3mdigital]:
 > After thinking about this more I agree.  I also agree that using guid is
 not a good idea.  I've come up with a patch that works nicely and will get
 the post or attachment ID of any attachment image.

 Great!

 > The basic premise is checking if the url has an image extension then
 parsing it and extracting the string that would be save in postmeta as
 `_wp_attached_file` It also checks if it is a resized image and slices out
 the width x height bits.

 Nice work.

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


More information about the wp-trac mailing list