Is WordPress Code Really a Mess?

By Daniel Pataki Updated on July 14, 2018

The author said:

My dislike of WordPress is no secret. I look down on its mess of a code base, and advise anyone with any technical knowhow whatsoever against using it.

Is the situation that dire? Is the WordPress core code really so atrocious that you should steer clear altogether and use something else for your project? In this article I’ll take a look at the issue and help pour some clarity on it.

What Is Bad Code?

I think the fundamental issue is that noone really says what bad and messy code is. On paper something like “messy code” sounds horrible, but does a casual reader know what that means? More importantly, does she/he care?

As always, there is a little more to it than that. There are a few properties that could make code “bad”, here are just a few:

  1. Unoptimized code which performs slowly compared to optimized code
  2. Mixing coding styles within a project
  3. Spaghetti code which can only be understood by the author
  4. Unextendable that doesn’t play nice with others

WordPress is indeed guilty of one and a half of these. The coding style is all over the place, that’s for sure. Function names are inconsistent, some modules use a strict object oriented approach, some modules use procedural code, many files don’t use WordPress’ own style guide, – just a few issues.

This means that WordPress uses spaghetti code somewhat, but apart from being annoying it’s not a problem because literally thousands upon thousands understand it since it is such a widely used product.

So is WordPress badly coded? Yes, in the same way as the International Space Station uses bad laptops. Both statements are objectively true but there’s a bit more going on behind the scenes.

The real question is, does this matter?

Coders Don’t Matter

At every WordCamp I go to I get asked the question: would it be great if WordPress switched to a fully OOP approach. The programmer in me says, yes of course, it would be the happiest day in my life. The rational person in me (definitely not the programmer) preaches caution since this move would directly contradict everything WordPress stands for.

As programmers we have to remember that WordPress – at the end of the day – is for the users, not for us. You may think that spending 100+ hours on a project is a lot but the person who uses your work may spend 8 hours a day using it which would amount to 3,000+ hours a year, and that’s only if your work is used by a single user.

As programmers we have to remember that WordPress at the end of the day is for the users. Click to Tweet

Users Don’t Care

Users really don’t care about anything related to code. They want something that is user friendly, fast and secure. WordPress does very well on all three. You can argue that badly coded plugins can ruin WordPress’ speed and safety but that’s like saying my Volvo wasn’t safe because I got injured driving 180 miles an hour into a wall.

Coder’s Aren’t Affected

The vast majority of people who work with WordPress aren’t affected by this issue, or at least don’t have to be. There is simply no situation where you would need to touch core code for a project. This means that you won’t be affected by the messiness of the core code at all.

The only argument coders could have against WordPress is that it doesn’t follow an MVC (model-view-controller) architecture. This is a completely valid criticism, but it’s not like MVC is the only way to write clean code.

In fact, you can use a full on object-oriented approach in plugins and even use and MVC-like structure if you prefer. The real problem is with themes which are built in a way that you can’t just inject MVC principles.

That said, themes follow strict guidelines and are well structured, despite not being MVC. This boils down to a common vein in every theme which makes it easy to work with them if you know what you’re doing.

Is It Possible to Write Good Code?

The issue is not wether WordPress core code is good or bad. WordPress core code is somewhat of a mess, but it is still good code. This doesn’t mean it couldn’t be vastly improved but for the purposes, it serves it is great.

The issue is: is it possible to write good code with WordPress. The answer is a resounding yes. As I mentioned earlier, plugins are free-form so you can do whatever you like there, including OOP.

I do also want to stress that OOP is not a cure-all. For simple plugins, a well laid out procedural approach may be a lot clearer.

Did you know that WordPress now powers over 31% of all websites?

Kinsta is proud to have worked with some of the biggest names in the industry, such as GE, Intuit, TripAdvisor, and Mint. Our WordPress hosting solution is truly one of a kind, powering businesses of all sizes!

Themes do mix presentation with logic, this is undoubtedly a bad practice. However, the guidelines for themes are well laid out and with some planning a structuring you can write a logical and easy to follow theme.

With the advent of the WordPress API all other criticisms go down the drain because you can pretty much use the data in the database anywhere. You could use Laravel for everything and pull in the data via the WordPress API.


So at the end of the day, is WordPress code a mess? Yes, some of it is. Some plugins and themes really do contain bad code and hinders the community as a whole. Like any other project WordPress is not perfect. Just like any other project, I agree that WordPress should not be used for everything.

However, not using WordPress because “the code is a mess” is – to put it plainly – a dumb and shortsighted reason. While the core code is a bit of a jumble it is fast and secure. Any code written on top of that to extend the system can be written well.

The trick is to employ professionals, use trustworthy and high-quality products and maintain your website properly. And what platform or any other area of life is that not true in?

Not using WordPress because the code is a mess is a dumb and shortsighted reason. Click to Tweet
If you enjoyed this article, then you'll love Kinsta's WordPress hosting platform. Whether it's speeding up your website or getting 24x7 support from our veteran WordPress team, we're here to help your business succeed. Our Google Cloud powered infrastructure focuses on auto-scaling, performance, and security. Let us show you the Kinsta difference! Check out our features

Hand-picked related articles

Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted.
  1. Gravatar for this comment's author
    Johny Radio March 10, 2016 at 10:05 pm


    thx for the article! Some comments:

    “On paper something like “messy code” sounds horrible, but does a casual reader know what that means? More importantly, does she/he care?”
    — but why do we care about ‘casual readers? i think the author was referring to people with “technical knowhow”, who are building something– not ‘casual readers’.

    “Users really don’t care about anything related to code.”
    — so you’re arguing that NO system in the world (not just WordPress) need be well-coded, because, as long as it gets the job done, users don’t care. Maybe that’s a legitimate position, but i think a lot of professionals would heartily disagree with that.

    “Themes do mix presentation with logic, …undoubtedly a bad practice. However, …with some planning …you can write a logical and easy to follow theme.”
    — this seems a resounding indictment, but you’re excusing it. I think it’s ok to say this is points against WordPress. Coders should not have to go out of their way to work around WP’s poor design.

    “With the advent of the WordPress API all other criticisms go down the drain”
    — at that point, if you’re not using the WP front-end, it’s pretty much not WordPress anymore. A database is a database.

    My question is, why can’t a funded outfit like Automattic be bothered to do a proper rewrite? It’s a mature enough product at this point,


    1. Gravatar for this comment's author
      Jon Penland March 12, 2016 at 7:54 pm

      If Automattic bothered to do a “proper rewrite” they would own the resulting program. It would no longer be open-source WordPress but a proprietary platform that was an offshoot of WordPress. It wouldn’t be WordPress anymore, it would be something else entirely.

      A complete rewrite isn’t possible because no one has central control over what happens to WordPress.

      1. Gravatar for this comment's author
        Johny Radio March 17, 2016 at 8:45 am

        What definition of “open source” means that “Automattic cannot modify WordPress”? Open Source means ANYONE can modify it– including Automattic.

        1. Gravatar for this comment's author
          Jon Penland March 17, 2016 at 8:52 am

          I never said “Automattic cannot modify WordPress”. Sure they can submit modifications, but they don’t have the ability to complete a rewrite and force it on the WP community.

          Automattic and are not one and the same. While there are ties and crossover between the folks who manage the different parts of the WordPress core and Automattic, Automattic doesn’t run the show at

          Take another piece of open-source software, let’s say Joomla! for instance. No single company or developer has the right or ability to completely rewrite Joomla and force the changes on the rest of the Joomla community. Same situation with Automattic and WordPress.

          Heck, would you really want a private company like Automattic to completely rewrite an open-source piece of software used by millions of websites? That’d be like giving them permission to reach into the wallets of every WordPress website on the internet.

          1. Gravatar for this comment's author
            Johny Radio March 19, 2016 at 3:22 pm

            i have not coded on an open-source project, so i don’t know much about it.

            but, if it’s allowed for anyone to submit a mod, then it’s not against open-source for automattic to submit lots of mods that fix whatever’s wrong with wp.

            i never said automattic should “force” anything on anyone. is that even possible in open source projects?

            your example of joomla doesn’t really add anything, you just switched the word “wordpress” for the word “joomla”.

          2. Gravatar for this comment's author
            Jon Penland March 19, 2016 at 7:38 pm

            You’re right, and lots of Automattic folks do contribute updates to the WP core.

            As far as the wordpress/joomla deal goes, I just know some folks don’t really understand the difference between Automattic / / You’re right again – it didn’t really add anything, I was just trying to clarify.

          3. Gravatar for this comment's author
            Milos Radojevic August 14, 2016 at 8:43 pm

            You are totally wrong Jon. As wordpress is released as I guess under GNU/GPLv2 licence, they have rights to do anything they want with code, and as they earn out of same code, they can decide whatever they want. And I don’t blame at all WP community, they are amazing, but more Automattic, because guys just don’t want to invest in WP, just to continue earning money and leave as is to community. Open Source doesn’t mean that you don’t have rights, it means that other people have rights to use it, see code and change it under SPECIFIC conditions. They have full rights to do versioning and decide whatever they want on their project, but if they make wrong move, they will make many Open Source programmers stop contributing if they do something bad. So no, that can only be an excuse. PHP is also Open Source and was just functional programming language, and compare v7 to v4 and you will see huge difference. I don’t know but I found it dissapointing immediately when I just downloaded and find out that “dolly” plugin is written like someone was playing from high school, not aligned, just bunch of code. Btw, I don’t say WP as WP is bad, just it’s design is awful, semantic is bad, spaghetti is small word for it. It is just a mess. For blog its amazing piece of software, but anything else… Nah

  2. Gravatar for this comment's author
    logixca June 20, 2016 at 9:32 pm

    As long a it works, I’m delighted!

  3. Gravatar for this comment's author
    Tom March 10, 2017 at 1:25 pm

    “You can argue that badly coded plugins can ruin WordPress’ speed and
    safety but that’s like saying my Volvo wasn’t safe because I got injured
    driving 180 miles an hour into a wall.” ARE YOU FOR REAL?!! Not even close. It’s like saying your Volvo wasn’t save because you installed ducttape seat belts on a recommendation and strapped jet engines to the outside for better speed.
    The driving into wall thing is like saying a new stereo system caused this…

  4. Gravatar for this comment's author
    Emmanuel B. Lepage July 14, 2017 at 8:25 pm

    Hi, thanks, I was just looking a piece of pasta code and WordPress. Which themes would you recommend? I’m really new at coding, but I would like eventually open and tire apart my website and see how things are working and improve them :)

  5. Gravatar for this comment's author
    Nodws August 10, 2017 at 2:31 pm

    Yes they should rewrite the code base, but certainly not in OOP and stay way of the dated MVC approach for a less bloated source *cough* laravel

  6. Gravatar for this comment's author
    walt November 23, 2017 at 9:55 am

    Often it is a spaghetti code.

  7. Gravatar for this comment's author
    Mike Rees January 19, 2018 at 7:46 am

    I find the statement that WordPress is secure to be unjustified at best, and false at worst. There have been a number of high profile vulnerabilities in WordPress over the years, including implications in the Panama papers leak. The compatibility with PHP 5.2.4, a version now 12 years old and unsupported for the past 7 years is an active decision that increases the vulnerability of WordPress by not making full use of 7 years of security enhancements in the core libraries of PHP.

    All of this is amplified by spaghetti code, which makes finding and patching problems a more time consuming, obtuse task.

    For anyone with technical knowhow, WordPress ought to be bottom of the list of established solutions because these problems are organisational in nature and persist to this day (as of writing this WordPress is on version 4.9.2, two major revisions since the introduction of PHP 5.3), and will not be going away any time soon.

Leave a Reply

Use WordPress?

Use WordPress?

Join 20,000+ others who get our FREE weekly newsletter with WordPress tips on how to drive more traffic and revenue to your business!


You have Successfully Subscribed!

Send this to a friend