Get email alerts about 404 errors on your WordPress site

Ever wanted to get email alerts about 404 errors on your WordPress site?

Jeff Starr over at WP Mix posted a snippet yesterday for doing just that. And I, having a little time on my hands, decided to give it the ol’ OOP-once-over.

The original WP Mix post called for dropping the entire snippet into the top of your WordPress theme’s 404.php file, but I generally don’t like to clutter up my template files with extra non-theme stuff. So I converted it into a class which can then be easily instantiated in with these two lines:

if ( class_exists( 'Clean_404_Email' ) )
	new Clean_404_Email;

Not bad, considering the original snippet called for dropping in 83 lines of extra code!

I also converted the email format to a use a table, just so it’s a little more orderly about it.

Many users take advantage of freely-available tools like Google’s Webmaster Tools or other services to track a site’s 404 errors. This class gives you the short and sweet of it, and there’s no waiting around. If somebody gets a 404 on your site, WordPress will email you on the spot.

The gist is available on GitHub and also embedded below.

Photo used under CC. Photo by Jeremy Keith (adactio/Flickr)

Unconscious Constants

It’s funny the unconscious constants we have in our lives.

For some people, it’s that feeling you get from the morning workout, or that quiet break during the day to catch up on your feeds.

At my university job, I work in a student-run newsroom, an office that I myself worked in as a student contributor for several years and have now occupied as a staff member for a couple more.

I’ve been sitting at the same section of the newsroom for years now and from my vantage point I see an office lined with tables and probably 35 iMacs all setup in neat little rows. There is a veritable tidal wave of technology at every turn. In front me of I have my MacBook and, of course, my cellphone in my pocket.

But despite having all that information ready at the touch of my finger tips, I’ve come to rely on one constant: the analog clock that hangs on the wall to my left.

I know, it sounds ridiculous. Every direction I look I can probably find the time, but somewhere, subconsciously, I’ve developed the habit of looking left at that clock on the wall.

So when the clock was moved last week, it really threw me for a loop. I’d catch myself glancing in that direction three or four times a day. I’d already done it twice this morning and decided enough was enough. I’d gotten so distracted by my constant clock being gone that it was affecting my productivity.

I rooted through the supply closet and managed to unearth a long-discarded, half-broken clock. But popping a battery in that baby gave me the oh-so-familiar tick tock of my constant clock.

That clock is on the wall and I’m back to happily pecking away at my desk.

The lesson I’ve learned is that sometimes it’s all the little things put together that help you stay on your game. For me, it was an analog clock.

Photo used under CC. Photo by Lisa Yarost/Flickr.