“Id.” is Short for “Identifier”

As you can see, my OCD acts up when I see WordPress using uppercase “ID” in core function names, such as the get_the_ID() function.

“Id.” (note the period), as used here, is an abbreviation (contraction) of the word “identifier.” It is not an acronym, nor a “multi-word abbreviation” (i.e. for something like “Identity Document”), so it should not be all uppercase.

Also, according to WordPress’ own naming conventions, all function names should use lowercase letters and underscores for separating words.

Use lowercase letters in variable, action, and function names […]

And I wonder why I never get anything done …

Code Comments Say What?

I came across another sentence in Professional WordPress Plugin Development that made me stop and think for a minute:

The major benefit to code commenting is to explain what your code actually does, in plain English.

The triggering word being what.

I always believed that code comments should say why. What should be easy to discern from good code, without the need for additional commentary.

I’m using this rule of thumb for code comments:

Code says what, comments say why.

Name Collisions in PHP

I came across this passage in Professional WordPress Plugin Development:

[…] it’s essential that you prefix everything with a unique prefix. […] one of the most common errors in plugins is using all too common names for function and variables. […] the website will break because you can’t have two functions with the same name in PHP.

So, if I install two plugins from different developers, I cross my fingers and hope that they haven’t used any of the same variable or function names, else my site will suffer the consequences. Plugins are compatible by chance.