Skip to content

Commit

Permalink
pass the expected WP_Post object instead of id
Browse files Browse the repository at this point in the history
`is_post_notifiable()` was returning `false` because the passed `id` wan't a `WP_Post`
  • Loading branch information
iandunn committed Sep 29, 2023
1 parent a9629f2 commit 02ae763
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct() {
// Sync with the wp.org username changes.
add_filter( 'update_post_meta', array( $this, 'username_meta_update' ), 10, 4 );
add_filter( 'delete_post_meta', array( $this, 'username_meta_delete' ), 10, 3 );
add_action( 'wp_after_insert_post', array( $this, 'maybe_notify_on_post_save' ) );
add_action( 'wp_after_insert_post', array( $this, 'maybe_notify_on_post_save' ), 10, 2 );

add_action( 'camptix_rl_buyer_completed_registration', array( $this, 'primary_attendee_registered' ), 10, 2 );
add_action( 'camptix_rl_registration_confirmed', array( $this, 'additional_attendee_confirmed_registration' ), 10, 2 );
Expand Down Expand Up @@ -132,10 +132,8 @@ public function username_meta_delete( $meta_ids, $object_id, $meta_key ) {

/**
* Add the organizer or speaker badge when notifiable post types are saved and User ID meta exists.
*
* @param WP_Post $post The post object.
*/
public function maybe_notify_on_post_save( $post ) {
public function maybe_notify_on_post_save( int $post_id, WP_Post $post ): void {
if ( wp_is_post_revision( $post ) ) {
return;
}
Expand Down

0 comments on commit 02ae763

Please sign in to comment.