The warning occurs because PHP no longer allows required parameters to follow optional ones in function definitions, starting from PHP 8.0+. Our plugin currently has a function where a required parameter ($referral
) comes after an optional one ($affiliate_id
) because writing it this way used to work in PHP 7.x. But, this structure is now deprecated in PHP 8.x, prompting the notice.
public function can_receive_store_credit( $affiliate_id = 0, $referral )
You can adjust your WordPress debugging and error display settings to suppress this warning (and others like it) until we can fix this. First, in your wp-config.php
file, ensure debugging is turned off entirely by setting WP_DEBUG
to false
which turns off all debugging messages like this.
define( 'WP_DEBUG', false );
If debugging must stay on for other purposes, add the following configuration instead to wp-config.php
:
define( 'WP_DEBUG', true ); // Keep debugging on.
define( 'WP_DEBUG_LOG', true ); // Logs issues to wp-content/debug.log instead.
define( 'WP_DEBUG_DISPLAY', false ); // Prevents output of issues to the screen.
If for whatever reason you still see the notice, try adding this as well to wp-config.php
:
@error_reporting( E_ALL & ~E_DEPRECATED ); // Hides deprecated warnings alltogether.
Lastly you can downgrade to PHP 7.4 which should not show this kind of notice.
Hope that helps.