[wp-trac] [WordPress Trac] #16283: post_exists() enhacement - don't include revisions

WordPress Trac wp-trac at lists.automattic.com
Tue Jan 18 13:33:52 UTC 2011


#16283: post_exists() enhacement - don't include revisions
----------------------------+-----------------------------
 Reporter:  durin           |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:  3.1
 Severity:  normal          |   Keywords:  post_exists
----------------------------+-----------------------------
 The current post_exists() function to me has a major downside.  By default
 all it does it search for title, content and/or date in the wp_posts
 table.

 The problem with this is that it includes revisions.  So for example if
 you have a post with title "ABC" but then later change it to "DEF",
 post_exists("ABC") will still return true with the post ID of the
 revision.

 I would suggest either:

  a) Adding post_status not equal "inherit" as a default to the function.

  b) Adding a 4th parameter which allows you to pass the post_status value
 in.

 I would be happy to code this if anyone has any feedback on what would be
 the best approach.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16283>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list