Make WordPress Core

Opened 5 weeks ago

Last modified 5 weeks ago

#63115 new enhancement

wp_insert_post missing do_action for pre_post_insert

Reported by: hrohh's profile Hrohh Owned by:
Milestone: 6.9 Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:

Description

Hi, it is possible add new action
https://github.com/WordPress/wordpress-develop/blob/6.7/src/wp-includes/post.php#L4382-L5078
to line 4792

<?php
do_action( 'pre_post_insert', $data );

like we have in update

<?php
do_action( 'pre_post_update', $post_id, $data );

It would be usefull for detection duplicate content in database for example. We can rewire our post_id.

Change History (2)

This ticket was mentioned in PR #8527 on WordPress/wordpress-develop by @sainathpoojary.


5 weeks ago
#1

  • Keywords has-patch added

This PR introduces the pre_post_insert hook, allowing developers to modify or inspect post data before insertion, similar to pre_post_update. This enhances flexibility for use cases like duplicate content detection.

Trac ticket: #63115

#2 @peterwilsoncc
5 weeks ago

  • Milestone changed from Awaiting Review to 6.9
  • Type changed from feature request to enhancement
  • Version 6.7 deleted

I can see how this would be useful for consistency with the actions for updating a post.

As it's an enhancement, it won't be possible to get in to WordPress 6.8 so I've added it to the milestone for WordPress 6.9.

Note: See TracTickets for help on using tickets.