When you're totally stuck on a programming problem, sometimes the best course of action is to quit.

Stuck on a Programming Problem? Just Quit.

There comes a time in every developer’s existence when they find themselves stuck on a programming problem.  We’ve all been there:  blood-shot eyes, pulsing veins in our foreheads, and synapses dying at a rate unheard-of since that Robitussin dare you took your senior year of college.

In that moment when Stack Overflow and your own brain have completely let you down, what do you do?

You quit, that’s what.

That’s right: quit. If you’ve already beat your head against a wall for several hours, doing it more eventually stops being productive.

Get up. Step away from the screen. Do something else. Play a video game. Go for a walk. Work on another project. Write something. Build something. Make something. Cook something. Have a conversation. Write some perfectly useless code in a different programming language. 

Whatever you do, do something that shifts your mindset. It might take an hour. It might take a day.  It might take a week. But returning to a project with fresh eyes can make all the difference.

So next time you find yourself staring at the same lines of code a little to long, remember: be a quitter! (Just not, like, permanently. That’s just sad.)

WordPress Limits The Number of Items on a Menu

I just ran into a problem on a client site: I went to add two new items to their primary navigation. The first was was successful.  And even though clicking save said it was successful, when the Menu tool refreshed and I refreshed the live page, the second item was missing.

WordPress doesn’t actually set a limit on the number of menu items you can have. It seems like it does though, since an never never actually occurs when it stops adding them.

Some Googling turned up this issue in the WordPress Bug Tracker. Apparently when you click Save WordPress returns every menu item as a separate request variable.  When you get to 89 menu items, the number of variables being sent passes the default limit set by PHP, and menu items 90 and beyond get ignored. While the fix suggested by the bugtracker didn’t help me, the solution was easy. I just added the following line to my site’s .htaccess:

php_value max_input_vars 2000

Adding that PHP configuration variable will override the default max_input_vars limit, which causes WordPress not to receive and therefore save menu items beyond 89.