post_exists() enhancement - don't include revisions
|Reported by:||durin||Owned by:|
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.
Change History (11)
comment:2 solarissmoke — 3 years ago
- Keywords dev-feedback added; post_exists removed
- Summary changed from post_exists() enhacement - don't include revisions to post_exists() enhancement - don't include revisions
comment:8 c3mdigital — 3 months ago
- Keywords dev-feedback needs-patch removed
- Resolution set to wontfix
- Status changed from new to closed
- Version changed from 3.1 to 2.0