I'm just getting started learning about the WordPress Core. WordPress's codebase is the first large codebase that I've looked thoroughly into.

The get_posts method in wp-includes/query.php is 1300 lines long. To me that is huge. Can I expect a lot more of these large functions in the codebase?



To give you some historical perspective WordPress core:

  • is relatively old code base, code volume tends to grow over time;
  • has extreme commitment to backwards compatibility, as result it's extremely rare for code to be removed from core;
  • is written in essentially obsolete dialect of PHP version 5.2 (which it remains compatible with), which resulted in monolithic core design and low separation between modules;
  • largely ignores code length and complexity metrics for the purposes of development and maintenance.

You don't make it completely clear if you are interested in PHP development in general or WordPress specifically. If you want some experience with modern PHP development style you should probably look at different projects, done in more current styles.

  • Drupal 8 is a great choice of framework to learn modern PHP development styles. – dotancohen Mar 28 '16 at 16:07
  • Ok! I'm learning wordpress development, plugins and themes, just curious of the inner workings. Clients seem to like wordpress as their cms. – Larry Lawless Mar 28 '16 at 16:07
  • @LarryLawless You don't have to know how Wordpress works internally to develop for it, you just have to know where to find API documentation. You can drive a car without the ability to build one yourself. – gronostaj Mar 28 '16 at 23:17
  • @gronostaj it's tangential to the question, but I can't fully agree with that. Shallow level of understanding of how things work inside API is one of unfortunate reasons for low average quality and compatibility of WP code out there. – Rarst Mar 29 '16 at 7:16
  • @gronostaj I agree with Rarst here. you just have to know where to find API documentation Most of the documentation (codex) is literally a pile of crap and some info is just totally wrong. – Pieter Goosen Mar 29 '16 at 8:18

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.