WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 14 months 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
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 (2)

post.php (165.4 KB) - added by johnnypea 3 years ago.
post.diff (395 bytes) - added by kapeels 3 years ago.
Patch instead of the file attached.

Download all attachments as: .zip

Change History (15)

comment:1 follow-up: nacin3 years ago

  • Keywords needs-patch reporter-feedback added; hook action post insert removed

Use case? Also, real patch please.

comment:2 in reply to: ↑ 1 johnnypea3 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.

johnnypea3 years ago

comment:3 nacin3 years ago

  • Keywords reporter-feedback removed
  • Milestone changed from Awaiting Review to Future Release

Please post a patch, versus a file.

kapeels3 years ago

Patch instead of the file attached.

comment:4 kapeels3 years ago

  • Keywords has-patch added; needs-patch removed

comment:5 kapeels3 years ago

  • Cc kapeels added
  • Keywords has-patch removed

comment:6 kapeels3 years ago

  • Keywords dev-feedback added

comment:7 SergeyBiryukov19 months ago

#22165 was marked as a duplicate.

comment:8 sirzooro19 months ago

  • Cc sirzooro added

Related: #18692, #18266

comment:9 nacin19 months ago

#22165 was marked as a duplicate.

comment:10 nacin19 months ago

#22165 was marked as a duplicate.

comment:11 thomask19 months 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.

comment:12 markoheijnen19 months ago

  • Version set to 3.1

The version is where it is implemented and not the latest version it occurs.

comment:13 SergeyBiryukov14 months ago

  • Component changed from Plugins to Post Types

Related: #21450

Note: See TracTickets for help on using tickets.