Opened 4 years ago
Last modified 4 years ago
#55920 new enhancement
Ability to query by post author in post_exists()
| Reported by: | mcqTia | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Posts, Post Types | Version: | 6.0 |
| Severity: | normal | Keywords: | changes-requested has-patch |
| Cc: | Focuses: |
Description
Needed the ability to determine if post exists by title && author when running wp_insert_post() in form submission.
I was using this to create a list of user saved favourite posts.
So this might be useful for others too
function post_exists( $title, $content = , $date = , $type = , $status = , $author = ) {...}
Pull Request #2783
Change History (3)
This ticket was mentioned in PR #2783 on WordPress/wordpress-develop by tiadotdev.
4 years ago
#1
- Keywords has-patch added
tiadotdev commented on PR #2783:
4 years ago
#2
All updates made, thanks for flagging!
What do I need to do for unit testing?
TimothyBJacobs commented on PR #2783:
4 years ago
#3
You'll want to add tests after this one. We'll want tests that check that the function returns true with a matching author ID and false with a non-matching author ID.
You can take a look at the Automated Tests Handbook for more guidance too.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Needed the ability to determine if post exists by title && author when running wp_insert_post() in form submission.
I was using this to create a list of user saved favourite posts.
So this might be useful for others too
function post_exists( $title, $content = , $date = , $type = , $status = , $author = ) {...}
Trac ticket: [](https://core.trac.wordpress.org/ticket/55920#ticket)