2

I am a real fan of the Allman (BSD) coding indent style. However, when i review the top rated plugins on WordPress, i am finding them using the K&R coding indent style.

Is there a requirement from WordPress.org that forces users to use the K&R indent style when developing plugins or themes? I read all the manual but couldn't get a clear answer on which indent style we are allowed to use.

Your help will be greatly appreciated.

  • 1
    You have read this? make.wordpress.org/core/handbook/best-practices/… – kraftner Feb 3 '17 at 11:51
  • 1
    while J.D. answer is probably correct, the only valid place to ask anything about wordpress.org, is the forums/slac/trac relating to it. policies that are valid today may change tomorrow and some de-facto guidelines might not be publicly documented. – Mark Kaplun Feb 3 '17 at 16:34
1

WordPress.org does not have any hard requirements for code styles for plugins or themes.

In the plugin guidelines, the relevant section is #4, "Keep your code (mostly) human readable." Mainly it is about obfuscation. The most relevant line is this:

We recommend following WordPress Core Coding Standards.

Note the word recommend, there. This is not a hard requirement.

The relevant portion of the theme review guidelines doesn't really mention code style directly, so there's no requirements for this kind of thing for themes either.

I'm kind of glad that there is some freedom here, but you will find that there's plenty of very messy code in the plugin directory, that doesn't really follow any one code style consistently at all. That's allowed—for better or worse. :-)

  • Thank you very much for taking the time to explain all that. On the official forums, I have got an interesting answer regarding this question. It was literally a link to github.com/WordPress-Coding-Standards/… – Ken Feb 4 '17 at 0:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.