Skip to content

Small error in clearing of notices #2

@westende

Description

@westende

Hi,
Thank you for your work on this handy library. There is a small bug in the clearing of notices on the master branch.
Hereby a patch:

diff --git a/wp-flash-notices.php b/wp-flash-notices.php
index 8530a0d..97a8288 100755
--- a/wp-flash-notices.php
+++ b/wp-flash-notices.php
@@ -91,7 +91,7 @@ class WP_Flash_Notices {
 		add_action( 'shutdown', [ $this, 'save' ] );
 
 		// Automatically clear all rendered notices.
-		add_action( 'wp_flash_notices_after_render', [ $this, 'clear_after_render' ], 10, 2 );
+		add_action( 'wp_flash_notices_after_render', [ $this, 'clear_after_render' ], 10, 3 );
 	}
 
 	/**
@@ -371,12 +371,13 @@ class WP_Flash_Notices {
 	 * using `render` method. If you have disabled automatic render
 	 * this method will not be executed.
 	 *
+     * @param string $transient Transient name to identify the plugin.
 	 * @param array $notices Notices array.
 	 * @param bool  $network Is network admin?.
 	 *
 	 * @since 1.0.0
 	 */
-	public function clear_after_render( $notices, $network ) {
+	public function clear_after_render( $transient, $notices, $network ) {
 		/**
 		 * Filter hook to disable automatic clearing of notices.
 		 *

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions