#56501 closed defect (bug) (invalid)
wp_after_insert_post hook, $post_before and $post showing same values
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 5.6 |
| Component: | REST API | Keywords: | |
| Focuses: | rest-api | Cc: |
Description (last modified by )
wp_after_insert_post hook, $post_before and $post showing same values.
WordPress 6.0.2
Gutenberg 14.0.2
PHP 7.4.28
Windows 10
Chrome
According to this: [49732]
It should "Pass the previous state of the post as a parameter to the wp_after_insert_post hook"
Change History (4)
#2
@
3 years ago
Thank you @SergeyBiryukov, I also am linking related issue here https://github.com/WordPress/gutenberg/issues/15777
#3
@
3 years ago
- Resolution set to invalid
- Status changed from new to closed
Sorry, it does work! I was just hitting it at wrong time. I was testing it using dump(tracy debugger):
bdump($post->post_title); bdump($post_before->post_title);
That's when the values were all the same but when I did a check like so it returned different values!
if($post->post_title !== $post_before->post_title){
bdump($post->post_title);
bdump($post_before->post_title);
}
else {
bdump('same title');
}
Looks like this can be closed.
Note: See
TracTickets for help on using
tickets.
Hi there, thanks for the ticket!
Appears to be introduced in [49731] / #45114 for WordPress 5.6, setting the version accordingly.