#56501 closed defect (bug) (invalid)
wp_after_insert_post hook, $post_before and $post showing same values
| Reported by: | wpfed | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | REST API | Version: | 5.6 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: | rest-api |
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
@
4 years ago
Thank you @SergeyBiryukov, I also am linking related issue here https://github.com/WordPress/gutenberg/issues/15777
#3
@
4 years ago
- Resolution → invalid
- Status new → 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.
Hi there, thanks for the ticket!
Appears to be introduced in [49731] / #45114 for WordPress 5.6, setting the version accordingly.