[wp-trac] [WordPress Trac] #39373: url_to_postid() returning postid for external url

WordPress Trac noreply at wordpress.org
Thu Dec 22 17:07:15 UTC 2016


#39373: url_to_postid() returning postid for external url
--------------------------+-----------------------------
 Reporter:  jkhongusc     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Embeds        |    Version:  4.7
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 One our site has a post that has a SoundCloud embed in it.  The WP embed
 is embedding the post instead of the SoundCloud content.  See  bug#37359
 as another person reported but flagged the wrong function.

 Unfortunately I dont have a fix.  This is what I see, the post
 (https://bedrosian.usc.edu/podcast/drown/) embed eventually makes this
 call:

 url_to_postid ('https://soundcloud.com/uscbedrosian/drown')

 This is obviously (to human eyes) an external url but url_to_postid()
 returns the postid of the post  itself.  This site uses rewrites, I see
 url_to_postid() make this database call:

 SELECT wp_334_posts.* FROM wp_334_posts WHERE 1=1 AND
 wp_334_posts.post_name = 'drown' AND wp_334_posts.post_type = 'post' ORDER
 BY wp_334_posts.post_date DESC " ["posts"]

 Due to rewrites, all it has to match is 'drown' to be flagged as an
 internal url... and returns the original post.  Happens to all SoundCloud
 embeds on the same site.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39373>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list