Knowledgebase

Notice: Undefined variable or index Print

  • troubleshooting, wordpress, cpanel, plugins, themes, errors, guide, howto
  • 0

A value was used before being set.

WHAT IT MEANS

The code referred to something that does not exist at that point.

Usually harmless, sometimes a real bug.

WHY YOU ARE SEEING IT

Error display is enabled on a live site. It should not be.

Set display_errors off in cPanel > MultiPHP INI Editor, and enable logging instead.

On WordPress, set WP_DEBUG to false on a live site.

WHETHER TO FIX THE UNDERLYING CODE

If it comes from a plugin or theme, check for an update.

If it appears in the context of something not working, it may be the cause rather than a cosmetic warning.

If everything works and it is only a notice, it is low priority.

WHY IT MATTERS THAT IT IS VISIBLE

Notices printed on a live page expose file paths and code structure to anyone who triggers them.

They also break headers and produce other errors, since output is sent before it should be.

THE PRIORITY

Turn off display, turn on logging. Then decide whether the underlying code matters.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot