A lot of people assume WordPress is poorly written because it got a reputation for being insecure. But modern WordPress is pretty well written and in part due to its automatic update mechanism pretty secure.
When was the last time you looked at WordPress?
Building your own userland SQL Prepared Statements 'replacement' using string replacement is not "pretty damn good".
WordPress is notorious for refusing to drop support for ancient, unsupported versions of PHP.
WordPress is a fucking terrible solution to any problem, from a technical point of view.
Blender is another one that seems very ramshackle and complex. I won't go as far as saying it's poorly written, but it's a product of many contributors, including students, and yet it's an amazing piece of software.
This thread is not meant to be a criticism of projects, but a celebration that code quality is not the be all and end all.
BUGS
The source code is not comprehensible.
That's probably one of the dividing lines. There are many programs that have "bad" source code, but which are still essential.Another measure of "badness" could be how extensible, or not a program might be. Or even how many security-holes. With regard to security holes some projects such as Wordpress or Wireshark crop up too often.
But honestly? Most of the badly written programs aren't so bad, if you ignore a couple of outliers. If the benefits outweigh the drawbacks then the software leaves the world a better place.
1) Most of Linux source code is composed of drivers;
2) Most drivers for Linux have really bad quality code, with very few exceptions;
Then Linux is a perfect example.