Steve Taylor photo

Solving WordPress problems

I periodically get queries about WordPress issues through this site, often in relation to code I’ve posted here. These days I’m usually far too busy to go into deep, free coding consultation; and usually when I do help out I’m just Googling and using the same resources available to everyone.

I totally appreciate that I might have much more experience than some people, and I’ll have a few little hints that could save a lot of time. But sometimes people emailing me seem to be doing something that I fully confess to being guilty of, in the past and even now: shouting out for help too soon instead of stepping back and tackling the problem properly.

So, here’s a little guide I can point people to, partly in lieu of an email reply template. If you’re facing a WordPress coding problem that either looks daunting right from the start, or is driving you insane after hours of trying, the following hints can help a lot.

  1. Take a deep breath

    Literally. Take few calm, deep breaths. Maybe have a break, make some tea, do some washing up, something mundane with your hands. If time isn’t too pressing, sleep on it and have a go in the bright morning light. Very often tricky coding problems solve themselves in half-sleep states, or within seconds of sitting down in front of the issue with a fresh mind.

  2. Try it out!

    I feel no compunction in being withering about this, because I’m putting myself down as much as anyone. But really—how many times do we fire off a question to a list or forum asking whether XYZ will work or not when there’s something very close to hand that will tell us immediately: giving it a go! Try stuff out in a test environment. Try, tweak, try again… It’s very simple ;-)

  3. Trying out stupid-seeming stuff in a mechanical fashion is better than staring and staring

    I’m just adding this tip now because of current experience debugging JavaScript. It’s a principle that probably applies for most coding. Of course, the ideal situation is where you’re conceptually on top of everything and know how to attack problems in a targeted manner. But if you were in an ideal situation, you wouldn’t be reading this, I imagine.

    So, if you’ve been staring at a problem for far too long, just try stupid stuff. Output variables to see what they are. Try stuff even if you’ve no idea what it will do (in a test environment of course!), and even if you’re not really sure if it will help. Just hack away at it—at the very least, it might break that cognitive log-jam.

  4. Search and ye shall probably find

    I can’t tell you how many replies I’ve sent to coding enquiries which basically consist of links to Google searches. I know this has an edge of facetious impatience about it, but most times it’s a plain answer. The solutions are sometimes right there, in the first page of results of a simple search.

    I’ll mention one specific thing here, which is that although I don’t have it bookmarked, Stack Overflow posts come up very frequently in tackling coding issues, and they’re often the best. One to watch for.

  5. Essential WordPress resources

    • The Codex

      It’s far from perfect, but it’s often essential Getting better all the time, especially the Template Tags and the Function Reference.

    • 3rd-party WP reference

      There’s some good “unofficial” WP documentation sites / reworkings, including the WP Hooks Database (docs on actions and filters), a WP API browser, the Roadmap (not being updated it seems, but a good way of seeing the order in which files and hooks are processed for any particular WP request), and tools to search the WP source.

  6. WP support forums

    Someone may have solved the issue already. If not, someone might have a moment to help…

  7. wp-hackers

    This is one of the key WP development community resources, for coding issues a little more advanced than you’ll find in the forums.

  8. Ask for free advice from a WP developer

    Well, I’m writing this to try and suggest other routes, so obviously this should be a last resort ;-) That said, if you’re really stuck after trying all the above, you never know. The WP community does have many people like me who, because they appreciate making a living from other people’s work given for free, will occasionally devote a little time to helping a fellow developer out just for the hell of it…