• How To Get Distracted Part 3: define( ‘WP_DEBUG’, true );

    How To Get Distracted Part 3: define( ‘WP_DEBUG’, true );

    The PHP define() function allows you to define a named constant. It can be very useful. It can also be very distracting if you set it to the WRONG value. So what is the wrong value for WP_DEBUG?

    It depends…

    An IBM architect’s answer to a difficult question is nearly always

    It depends

    A good architect will then follow up with a clarification or some further questioning.

    Right and wrong values for WP_DEBUG

    The expected values for WP_DEBUG are: true or false. Note: Any value other than false (e.g. yesplease) is considered true. When it’s set to false ( the default value in wp-config.php ) then Notification messages aren’t displayed. When it’s set to true then they are.

    In my opinion the right and wrong values are:

    • TRUE if you are a WordPress developer working on your local machine developing plugins for others to use
    • FALSE for a Live site
    • FALSE if you need to test something locally using a plugin or theme that misbehaves. See below.

    So what was the distraction?

    Earlier today, I decided it was time to install a caching plugin for my WordPress sites which were starting to attract visitors. So I took a quick look at the options and chose a couple to try. I gave up with my second choice instantly; it produced a Fatal error. The first one wp-super-cache is still installed BUT I’ve suffered the following distractions.

      • Far too many Notice: Undefined variable notification messages for my liking
      • which led me to a WordPress issue on the subject and a not particularly helpful answer with a link…
      • I followed the link and watched a very amusing wedding proposal video
      • On returning to my local site I started getting annoyed by the Warning! wp-content is writeable! message
      • Then I tried to test the cache and it didn’t work
      • AND I discovered a problem in my oik bwtrace code, which was producing a “Fatal error: print_r(): Cannot use output buffering in output buffering display handlers”
      • So I found some code from the PHP documentation for print_r: obsafe_print_r()
      • BUT this ALSO produced Notice: Undefined variable messages
      • So I’ve fixed those and now
      • google-analytics-for-wordpress has joined in with “Notice: undefined offset”
      • So I’ve deactivated that (it’s a local install after all) BUT the home page is still cached and totally effed up
      • AND I’m damned if I’m going to change my setting of WP_DEBUG to false since I’m a plugin developer too and I want to attempt to write good code which won’t annoy other developers too much.

    Example of a really annoying message…. since it is issued BEFORE <!DOCTYPE> is

    Notice: Undefined variable: cache_wptouch in ...\wp-content\plugins\wp-super-cache\plugins\wptouch.php on line 109

    Notice Undefined offset

    , , ,


    Last updated:

    May 14, 2015

Today’s word is this:







Tide times from tidetimes.org.uk

Tide Times & Heights for Langstone Harbour on
24th May 2024
00:39 High Tide ( 4.72m )
05:52 Low Tide ( 1.15m )
13:04 High Tide ( 4.63m )
18:10 Low Tide ( 1.25m )

Tide times from tidetimes.org.uk

Tide Times & Heights for Northney on
24th May 2024
00:44 High Tide ( 4.4m )
05:50 Low Tide ( 0.77m )
13:11 High Tide ( 4.31m )
18:05 Low Tide ( 0.97m )