Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Visible PHP warnings on your page: how to find and fix them

PRF-290High impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

PHP is the language that runs WordPress, WooCommerce and many custom sites. When the code hits a problem, PHP can print a message straight into the page. You see lines such as Warning: Undefined array key "email" in /wp-content/themes/mytheme/form.php on line 42 or a long stack trace (a list of the function calls that led to the error).

Why it costs you leads or sales

Visitors judge trust in seconds. Raw code in a headline or above a checkout button looks like a hacked or abandoned site, so people leave. Messages can also push your layout around, hide a button, or break a form that relies on the page rendering fully.

There is a security cost as well. Messages reveal server paths, plugin names, database table names and sometimes query details. Attackers use this to target known weak plugins.

How a warning can cost a sale
  1. Ad clickVisitor lands on page
  2. PHP warning printedRaw error text above the form
  3. Visitor loses trustPage looks hacked or broken
  4. Form submitNever reached

A warning on the landing page breaks the layout and trust before the form is reached.

Form conversion with and without visible errorsExample numbers
Form conversion with and without visible errors (example)Clean page: 4 %; Page with warnings: 1.5 %02341.5Clean pagePage with warnings%

Example: illustrative numbers only, showing how visible errors could depress conversion rate.

How to check if your site has it

Find visible PHP errors
  1. Open key pages in a private window

    Check your home page, landing pages, contact page, cart and checkout. Errors can be hidden for logged-in admins or appear only for visitors.

  2. Search the page text

    Press Ctrl+F (Cmd+F on Mac) and search for 'Warning:', 'Notice:', 'Deprecated:', 'Fatal error:' and 'Stack trace'.

  3. View the page source

    Errors may sit inside HTML comments or hidden elements. Open view-source: and search the same words, plus '.php on line'.

  4. Test different states

    Submit your form, add a product to the cart, open pages with URL parameters and check on mobile. Many warnings only appear after an action.

  5. Check the error log

    Look at your host's PHP error log or wp-content/debug.log. Frequent entries show which files raise warnings, even when they are hidden.

How to fix it

There are two jobs. First, hide errors from visitors straight away. Second, fix the cause so the log stays clean. Hiding is not a fix on its own, because a fatal error can still break the page.

Turn off error display
  1. Edit wp-config.php

    Set WP_DEBUG to false, or keep it true but set WP_DEBUG_DISPLAY to false and WP_DEBUG_LOG to true. Place these lines above the 'That's all, stop editing' comment.

  2. Find the source

    Read wp-content/debug.log. The file path in each message names the plugin or theme at fault. Update it, replace it, or contact its developer.

  3. Test by deactivating

    On a staging copy, deactivate plugins one at a time, or switch to a default theme, to find which one raises the warning.

wp-config.php: log errors, do not show themphp
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
Typical code fix for an undefined key warningphp
// Before: raises a warning if 'email' is missing
$email = $_POST['email'];

// After
$email = isset( $_POST['email'] ) ? sanitize_text_field( $_POST['email'] ) : '';
Page output

Before

  • Warning text printed above the form
  • File paths visible to anyone
  • Layout pushed down or broken

After

  • Page renders cleanly
  • Errors written to a private log
  • Underlying bug fixed in code

How to confirm it's fixed

Confirmation checklist
  • Reload key pages in a private window and search for 'Warning:', 'Notice:', 'Fatal error:' and '.php on line'
  • View page source and search the same terms
  • Submit your form and run a test checkout path
  • Check the error log: new entries should stop after the fix
  • Test on mobile and on the pages that use URL parameters

How to prevent it happening again

Prevention
  • Keep display_errors Off in production and use a log file instead
  • Test plugin, theme and PHP version updates on staging first
  • Review the error log regularly, or after every update
  • Remove abandoned plugins and themes
  • Check that your host's PHP version is supported by your plugins before upgrading
  • Re-check key pages after every deployment

How FunnelGuard handles this

FunnelGuard detects this issue only partly. During a scheduled journey run, it can check that the page text does not contain error strings you list (a 'text_absent' check). If a listed phrase such as 'Warning:' or 'Fatal error' appears on a step, the check fails and you get one alert, after a re-check from a second region, with a screenshot and a likely cause.

Questions people ask

Why is my website showing PHP warnings?

Your server is configured to print PHP errors into the page, and some code (often a plugin, theme or custom script) is raising a warning. Turn off display_errors and read the log to find the file causing it.

How do I hide PHP warnings on my WordPress site?

In wp-config.php set WP_DEBUG_DISPLAY to false, and optionally WP_DEBUG_LOG to true so errors go to wp-content/debug.log. Then fix the plugin or theme named in the log.

Is it safe to leave PHP warnings visible?

No. Messages expose file paths, plugin names and sometimes database details, and they make your site look broken to visitors. Hide them on live sites and log them privately.

Does hiding PHP errors fix them?

No. Hiding only stops visitors seeing the text. The underlying bug remains and can still break forms or pages, so fix the code that raises the warning.

What is the difference between a PHP warning, notice and fatal error?

Notices and warnings flag problems but PHP keeps running. A fatal error stops the script, so the rest of the page may not load. All three can appear on a page if display_errors is on.

How can I find which plugin causes a PHP warning?

Read the file path in the message or in the error log: it usually contains the plugin or theme folder name. If unclear, deactivate plugins one by one on a staging copy.

Can FunnelGuard detect PHP warnings on my pages?

Partly. It can fail a journey step if the page text contains an error phrase you list, such as 'Warning:'. It does not scan the whole site or read server logs.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: text_absent if listed.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.