I know a lot of people have asked this question but mine is not working with:
if(isset($instance['threadnumbers'] == "")){ $instance['threadnumbers'] == "" }
It shows a debugging errors on:
PHP Notice: Undefined index: threadnumbers in /home/content/59/12158859/html/development/wp-content/plugins/dpt/disqus-ptw.php on line 27
And that area is below:
if ($instance['threadnumbers'] == NULL) {
$instance['threadnumbers'] = "5";
}
How to fix it? Thanks a lot :)
You have a cut and paste error. You are trying to assign a value using a comparison operator. ==
should be =
.
You also are using isset()
on an assignment.
if(isset($instance['threadnumbers'])){ $instance['threadnumbers'] == "" }
should be
if(!isset($instance['threadnumbers']) || empty($instance['threadnumbers'])) {
$instance['threadnumbers'] = "";
}
Replace
if(isset($instance['threadnumbers'] == "")){ $instance['threadnumbers'] == "" }
With
if(isset($instance['threadnumbers'])){ $instance['threadnumbers'] = "" }
isset
will return true
or false
. When you loose compare it ( ==
), false
will equal ""
.
Also, $instance['threadnumbers'] == ""
should be $instance['threadnumbers'] = ""
, because you want to assign an empty string to the variable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.