Opened 19 months ago
Last modified 18 months ago
#57810 new defect (bug)
Should wp_insert_post() function call 'wp_insert_post' action with 'update' equals true after creating post for the first time.
Reported by: | zenithcity | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 6.1.1 |
Component: | Posts, Post Types | Keywords: | |
Focuses: | Cc: |
Description
The wp_insert_post() function calls 'wp_insert_post' action hook with 'update' equals true when creating post for the first time.
Post was created using the Gutenberg editor.
/* $update should only be true when updating post */
do_action( 'wp_insert_post', $post_ID, $post, $update );
Attachments (4)
Change History (9)
This ticket was mentioned in Slack in #core-test by ironprogrammer. View the logs.
18 months ago
#3
in reply to:
↑ 1
;
follow-up:
↓ 5
@
18 months ago
- Keywords reporter-feedback added
Thank you for the the report, @zenithcity!
Regarding the question around the $update
parameter, the passing of $update
in this manner has been around for some time (additional context), and would likely remain for backward compatibility reasons.
Are you able to provide more detail as to the console error/invalid JSON response? Is the wp_insert_post
hook being used by custom code?
Please anyone who can remove an attachment should help me unlink the first added attachment (Screenshot_20230226_014746.png) from this ticket. I can't see the delete attachment button.
The first attachment has been removed as requested.
#4
@
18 months ago
- Keywords reporter-feedback removed
Thank you removing the first attachment as requested, @ironprogrammer
So, all plugins are disabled and using the latest WordPress default theme. I added a var_dump('create: $update)
directly to where the do_action
is fired and created a new post to test, the result is shown on the screenshot.
@
18 months ago
Added var_dump to inspect value of $update in do_action( 'wp_insert_post', $post_ID, $post, $update );
#5
in reply to:
↑ 3
@
18 months ago
Replying to ironprogrammer:
Thank you for the the report, @zenithcity!
Regarding the question around the
$update
parameter, the passing of$update
in this manner has been around for some time (additional context), and would likely remain for backward compatibility reasons.
Are you able to provide more detail as to the console error/invalid JSON response? Is the
wp_insert_post
hook being used by custom code?
Please anyone who can remove an attachment should help me unlink the first added attachment (Screenshot_20230226_014746.png) from this ticket. I can't see the delete attachment button.
The first attachment has been removed as requested.
There's no error in console and the JSON response of the publish
post action is valid.
Please anyone who can remove an attachment should help me unlink the first added attachment (Screenshot_20230226_014746.png) from this ticket. I can't see the delete attachment button.