Opened 14 years ago
Last modified 4 years ago
#15230 new enhancement
Action hook before the inserting post into the database
Reported by: | johnnypea | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | Posts, Post Types | Keywords: | dev-feedback has-patch |
Focuses: | Cc: |
Description
Something like
do_action( 'pre_post_insert', $data, $postarr );
added to wp_insert_post function right after the "else" statement on line 2501 in .../wp-includes/post.php
Attachments (4)
Change History (23)
#1
follow-up:
↓ 2
@
14 years ago
- Keywords needs-patch reporter-feedback added; hook action post insert removed
#2
in reply to:
↑ 1
@
14 years ago
Replying to nacin:
Use case? Also, real patch please.
For example in case I want to check if such a post exists in the database before inserting it - almost every data inserted into the database has its "pre_insert_hook" so why posts not?. I know there is this wp_insert_post_data filter where can I do this check but anyways it is not the action hook.
#3
@
14 years ago
- Keywords reporter-feedback removed
- Milestone changed from Awaiting Review to Future Release
Please post a patch, versus a file.
#11
@
12 years ago
- Version 3.1 deleted
Please look at #22165 with real live use case. In http://core.trac.wordpress.org/ticket/22165#comment:3 there is another option how this can be solved.
Please change version to 3.4.2 - it is not possible for me now.
#12
@
12 years ago
- Version set to 3.1
The version is where it is implemented and not the latest version it occurs.
#14
@
9 years ago
- Keywords has-patch added
I'm working on membership plugin and every user has a certain number limit on add new post. I want to check total post count by the author before data has been save in the database but at the moment wp_insert_post
does not have a pre_post_insert
hook. It would be nice to add this hook in core.
#18
@
7 years ago
+1 for this
Use case: Make sure whatever happens, certain phrases will never be in a post. Do not care about whether they enter through a plugin using wp_insert_post()
in some way or through the editor, or through the REST API or whatsoever.
Using pre_post_insert
would help me to easier solve this request.
Use case? Also, real patch please.