Undefined array key (hope this isn’t a generic question)

[ad_1]

Hi all,

I keep receiving the error ” **Warning**: Undefined array key “sticky” in **C:\\xampp\\htdocs\\chatpet\\wp-content\\themes\\understrap-portfolio\\header.php** on line **33** ” when trying to apply a child theme to my site. In looking at line 33 using Visual Studio it says ”

<?php if ($\_GET\[‘sticky’\]==’true’){ ?>”

Is “sticky” a variable I need to define? I am very new to development but am eager to dive in. Thank you for all your help!

[ad_2]
2 Comments
  1. I am assuming the slashes are not in the code. Sticky in this case should be a variable defined in the HTML form that precedes this page. $_Get is a super global used to collect form data with the get method. In this case, looks like some bad code related to the array key, you will want to echo sticky or probably print_r the array to see what the problem is. Your error log in Xampp is also great for this, may have additional info. There’s also an active debugging community for understrap, I am active there as are a lot of better programmers than I.

  2. Change that code to `<?php if ( isset( $_GET[‘sticky’] ) && $_GET[‘sticky’] == ‘true’ ) { ?>`

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer