[wp-trac] [WordPress Trac] #32275: get_page_by_title could return an array with all the matches

WordPress Trac noreply at wordpress.org
Thu May 7 13:12:20 UTC 2015

#32275: get_page_by_title could return an array with all the matches
 Reporter:  brgweb       |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Query        |     Version:  4.2.1
 Severity:  normal       |  Resolution:
 Keywords:  close        |     Focuses:  template

Comment (by brgweb):

 Thank you for your comment. It's my first time here in core development.

 The problem I've found here was that I needed to query attachments with
 the same original filename. Since the filename is changed in the upload
 and the post-name is changed too, both to prevent duplicates, the easiest
 way to find it was querying by post_title (assuming that the user didn't
 change it after upload).

 The other option was to query the post-names removing the '-x' in theend,
 where x is the character added to prevent duplicates, but it would result
 in a bigger code.

 Maybe a better support to find attachments by its original filename would
 solve this kind of issue (don't know if it's a common issue...).

Ticket URL: <https://core.trac.wordpress.org/ticket/32275#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list