Issue with hook name and param callback
-
Hello,
You are using the three following hooks: add_post_metadata, delete_post_metadata, updated_post_meta in one of your sensors.
The last one is an add_action which has different parameters from the two others. Moreover, in the two add_filter you never return anything, meaning that the value returned will always be null.
The issue is located in this file: https://github.com/WPWhiteSecurity/wp-activity-log/blob/7c90d2a13f97db00a6f2d5a6f5c6061d7eb2bce6/classes/Sensors/Content.php#L103Could you please make a fix?
add_filter( 'add_post_metadata', array( $this, 'check_created_deleted_meta' ), 10, 5 ); add_filter( 'check_created_deleted_meta', array( $this, 'check_changed_meta' ), 10, 5 ); add_action( 'updated_post_meta', array( $this, 'check_changed_meta' ), 10, 4 ); /** * Check Page Template Update. * * @param bool|null $delete Whether to allow metadata deletion of the given type. * @param int $meta_id ID of updated metadata entry. * @param int $post_id Post ID. * @param string $meta_key Meta key. * @param mixed $meta_value Meta value. */ public function check_created_deleted_meta( $delete, $meta_id, $post_id, $meta_key, $meta_value ) { if ( ! $post_id ) { return $delete; } switch ( $meta_key ) { case '_wp_page_template': $this->check_template_change( $post_id, $meta_value ); break; case '_thumbnail_id': $this->check_featured_image_change( $post_id, $meta_value ); break; default: // no other meta keys supported here. } return $delete; } /** * Check Page Template Update. * * @param int $meta_id ID of updated metadata entry. * @param int $post_id Post ID. * @param string $meta_key Meta key. * @param mixed $meta_value Meta value. */ public function check_changed_meta( $meta_id, $post_id, $meta_key, $meta_value ) { if ( ! $post_id ) { return; } switch ( $meta_key ) { case '_wp_page_template': $this->check_template_change( $post_id, $meta_value ); break; case '_thumbnail_id': $this->check_featured_image_change( $post_id, $meta_value ); break; default: // no other meta keys supported here. } }<code></code>Thanks!
Best regards,
Chloé
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
The topic ‘Issue with hook name and param callback’ is closed to new replies.