19 Comments

  1. Miroslav Glavic

    For anyone wanting “modern coding standards”, can’t he/she/they/them just fork WordPress into a “modern coding standards”?

    Report

    • Justin Tadlock

      That would be a massive undertaking and would require a large group of developers. Time would likely be better spent working on core WordPress and improving areas where they can. The spread operator changes linked in the post is a good example of that. Those changes cleaned up several functions without breaking things.

      Report

      • WPezDeveloper

        True. But the longer the wait, the more massive the elephant gets. When a product is responsible for such a significant percentage of the internet at what point is it responsible and/or obligated to move itself – and all who depend on it – into the 21st Century?

        Report

  2. Lenin Zapata

    It is difficult, it is not easy to migrate a platform that is being used by millions of websites.

    Report

  3. René

    WordPress should go with PSR coding standards (1-12) like the rest of the PHP world goes: https://www.php-fig.org/psr/

    As the name says, the PSR is THE standard recommendations for PHP coding styles.

    There is no need to waste resources by implementing a custom WordPress coding standard that is not compatible with the PSR. If WordPress wants to attract more professional developers it’s the only correct answer.

    Report

  4. Henry

    A standard exists already for the language. If a change is necessary then why don’t we adopt that?

    Report

  5. Craig

    PSR-4 naming convention is something I think should be included in the WordPress coding guidelines. Autoloading is often considered a core php functionality these days.

    I wonder what other changes to WordPress coding standards will be necessitated by this single change. My father referred to this sort of thing as the “Pillow Effect” where he would end up remodeling the entire living room after my step mother goes shopping for a new throw pillow. (The new pillow doesn’t really match the current sofa, necessitating a new sofa, the new sofa doesn’t really look right with the old coffee table, so a new coffee table is needed, and so on & so on…)

    Report

  6. Ayan Debnath

    But will it improve the performance of WordPress?

    Report

    • Justin Tadlock

      Not really. There are likely some newer PHP features that are more efficient. However, the WP coding standards is more about formatting code and naming things for consistency across the code base.

      Report

  7. Pablo López

    This is something that is inevitable. Coding Standards need to be updated and the code base needs to be more robust, modern and scalable

    I have a blog about WordPress development and lately I try to write posts trying to explain good practices and modern PHP standards, for example: namespaces, named constructors, strict types… https://desarrollowp.com/tag/desarrollo-a-medida/

    Report

  8. Koen Reus

    Agreed on the PSR naming convention. A proper implementation of Composer would also be nice (without having to use a composer plugin to namespace your dependencies).

    Report

  9. Anh Tran

    There are some rules in the WPCS like file naming, namespace naming, etc. which makes me ignore them. I still find things like spaces in WPCS is good.

    If possible, for “new” things like namespaces, autoload, I’d suggest WP to follow PSR. It works out of the box with a simple line in composer.json. WP doesn’t have that and we all have to write our custom code to autoload classes.

    Report

  10. Frans Eldering

    Great idea to udjust the standards. Please commit to the PSR standards. That would be a mayor improvement :)!

    Report

  11. Mihir Pambhar

    I don’t know much about coding but WordPress is awesome and if it improve further by doing this it would be great

    Report

  12. WPezDeveloper

    What is the case for WP continuing to deviate from The Industry Standard? Is that case getting weaker for stronger? Does that direction help WP – and the people who use it – or hurt?

    I trust you see where this is going.

    Report

  13. Andres Abello

    I think that will do wonders for WordPress. The main issue right now is that is the wild west. Everyone codes to their standards, or no standards and you end up with code that has a high level of complexity, code should be easy to work with in order to add new features quickly and fix bugs.
    Less time working on code means more time working on adding more value and fixing bugs faster. Right now there are functions that go for hundreds of lines, that can moved into a whole group of service of classes that will make it a lot easier to work with.
    Also, this means that it can get faster because its not enough to just run the latest PHP, you also need to follow the standards and the new ways to work with that code, by doing so you are taking full advantage of the language’s caching and faster functions.
    Overall, I hope they do this soon. WordPress is screaming for it as it is very popular but very poorly written. We need a SOLID codebase.

    Report

Comments are closed.

%d bloggers like this: