When using the Gutenberg Block Editor the normal hooks for saving a post don’t have the same behavior as with the classic editor.
pre_post_update
save_post
wp_insert_post
For example, if you hook into the save_post
-hook the $permalink
and the $categories
will not return the new value, but instead the old value. Which is not the behavior that I expected from the classic editor.
add_action( 'save_post', 'custom_save_post', 10, 3 );
function custom_save_post( $post_id, $post, $update )
{
$permalink = get_permalink( $post_id );
$categories = get_the_terms( $post_id, 'category' );
}
How can I make it work so that I can retrieve the pre-updated permalink and the post-updated permalink?