PHP 8.1 – PHP Warning: Undefined variable $network in (…)
-
Hi,
After updating to PHP 8.1 we started on the lookout for issues and conflicts. One of this issues comes from the RankMath plugin.
We have the following block on our
functions.php
theme file:/** * Allows developers to change the OpenGraph image within theme. * The dynamic part of the hook name. $network, is the network slug. Can be facebook or twitter. * @param string $attachment_url The image we are about to add. */ add_filter( "rank_math/opengraph/{$network}/image", function( $attachment_url ) { return $attachment_url; });
And this results in the continued error on the logs:
[03-Jan-2023 14:47:56 UTC] PHP Warning: Undefined variable $network in /var/www/sites/ver7x1/public_html/production/wp-content/themes/hello-child/functions.php on line 43 [03-Jan-2023 14:47:56 UTC] PHP Warning: Undefined variable $network in /var/www/sites/ver7x1/public_html/production/wp-content/themes/hello-child/functions.php on line 43 [03-Jan-2023 14:47:56 UTC] PHP Warning: Undefined variable $network in /var/www/sites/ver7x1/public_html/production/wp-content/themes/hello-child/functions.php on line 43 [03-Jan-2023 14:47:57 UTC] PHP Warning: Undefined variable $network in /var/www/sites/ver7x1/public_html/production/wp-content/themes/hello-child/functions.php on line 43 [03-Jan-2023 14:48:15 UTC] PHP Warning: Undefined variable $network in /var/www/sites/ver7x1/public_html/production/wp-content/themes/hello-child/functions.php on line 43 [03-Jan-2023 14:48:37 UTC] PHP Warning: Undefined variable $network in /var/www/sites/ver7x1/public_html/production/wp-content/themes/hello-child/functions.php on line 43 [03-Jan-2023 14:49:03 UTC] PHP Warning: Undefined variable $network in /var/www/sites/ver7x1/public_html/production/wp-content/themes/hello-child/functions.php on line 43 [03-Jan-2023 14:49:04 UTC] PHP Warning: Undefined variable $network in /var/www/sites/ver7x1/public_html/production/wp-content/themes/hello-child/functions.php on line 43 [03-Jan-2023 14:49:21 UTC] PHP Warning: Undefined variable $network in /var/www/sites/ver7x1/public_html/production/wp-content/themes/hello-child/functions.php on line 43 [03-Jan-2023 14:49:39 UTC] PHP Warning: Undefined variable $network in /var/www/sites/ver7x1/public_html/production/wp-content/themes/hello-child/functions.php on line 43 [03-Jan-2023 14:50:02 UTC] PHP Warning: Undefined variable $network in /var/www/sites/ver7x1/public_html/production/wp-content/themes/hello-child/functions.php on line 43 [03-Jan-2023 14:50:37 UTC] PHP Warning: Undefined variable $network in /var/www/sites/ver7x1/public_html/production/wp-content/themes/hello-child/functions.php on line 43
Thank you.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘PHP 8.1 – PHP Warning: Undefined variable $network in (…)’ is closed to new replies.