[wp-trac] [WordPress Trac] #56501: wp_after_insert_post hook, $post_before and $post showing same values

WordPress Trac noreply at wordpress.org
Fri Sep 2 19:28:29 UTC 2022


#56501: wp_after_insert_post hook, $post_before and $post showing same values
--------------------------+------------------------------
 Reporter:  wpfed         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  REST API      |     Version:  5.6
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:  rest-api
--------------------------+------------------------------
Changes (by wpfed):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56501#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list