top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

Why is Wordpress code so “space-happy”?

+3 votes
Why is Wordpress code so “space-happy”?
posted Oct 19, 2015 by Vrije Mani Upadhyay

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

In WordPress,

The WP core, many WP plugins, and the WP coding standards themselves use a very “generous application” of the Space character (not for indentation, but “inside” of parens and brackets). This seems to be unique to WordPress – this style/philosophy does not seem to be present in other similar projects, PHP or otherwise.

For more information on this approach, see:

Example: foreach ( (array) $foo as $bar ) { ...

I’m referring to the space after foreach, after the first (, and before the final ) (and other similar spaces shown in “Space Usage” at the link above).

This style seems unnecessary to me – it requires more typing and (opinion)makes parsing code visually more difficult.(/opinion)

My desire is not to debate whether or not this style is a good idea. Rather, I simply want to understand the motives for why this is the recommended style. Even commenters on the WP coding standards are curious:

answer Nov 26, 2015 by Manikandan J
Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.