Warning with PHP 8.1: missing variable initialisation
-
Recently, I updated my WP installation to PHP 8.1. Then I checked my website and found a PHP warning:
Warning: Undefined variable $page_name in /homepages/24/d13366683/htdocs/e-script/wp-content/plugins/blog-introduction/blog-introduction.php on line 116
(Same warning came for line 123, too.)
The reason for this is an omission in your code: I suggest that you include
$page_name = FALSE;
after code line 97 (} else {
). Otherwise the variable$page_name
will not be initialised, if the calling page is not a WP archive page.
- The topic ‘Warning with PHP 8.1: missing variable initialisation’ is closed to new replies.