Undefined Index – PHP Text Widget Error Solution

Broken Glass like Broken Code

PHP Likes to Break itself

If you are using the PHP Text Widget in WordPress and get an error in your Admin section that reads:

Or something similar, there is an easy solution to this annoying problem. First, load up the file plugin.php from the plugins directory, usually wp-content/plugins/php-text-widget/plugin.php. You may want to download it using your FTP program so you can work on it locally and then update it.

Then, find these lines of code:

What you are going to want to do is replace that entire section with this:

That should solve the problem! The issue is that the plugin is calling $_GET[‘page’] without first checking if it exists. It’s not a huge error and won’t break your site most likely, but it is definitely a good idea to fix it. I was pretty happy when I tried this and it fixed it! Hopefully it will work for you too, let me know in the comments!

About Brian Johnson

Brian Johnson is a website developer and designer living in Minneapolis, Minnesota with a passion for code and WordPress. He spends his days building WordPress websites for small businesses, developing new code with the online community, and living life.