Load your fancy pants plugin or theme on a fresh install

You probably forgot to check if an option isset() before relying on it.

I know, you’re just about done working on that theme you’ve been toiling away on forever. You’re ready to write your documentation and package it up. You’re clicking through everything to make sure you haven’t forgotten something.

Except you’re doing that on an install that’s already packed full of data. Take the time to set up a completely fresh install of WordPress, make sure WP_DEBUG is on, and then try installing your plugin or theme on it.

If you’re storing options as a serialized array, you’re probably doing something like this:

$myoptions = get_option( 'myoption' );
echo $myoptions['single_option'];

That works great when a single option exists. But on a fresh install with no option data in the database, you’ll get a PHP Notice. Take the time to install your code on a blank slate so you catch this stuff. That’s the environment of everyone who installs your plugin or theme.

$myoptions = get_option( 'myoption' );
echo empty( $mytoptions['single_option'] ) ? $myoptions['single_option'] : '';

You know better. We all do. But then we forget and do something stupid.