WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
yes that's huge, another one that comes to mind is redirect_canonical() with few hundred loc. – birgire Mar 28 at 16:00


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.

share|improve this answer
Drupal 8 is a great choice of framework to learn modern PHP development styles. – dotancohen Mar 28 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 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 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 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 at 8:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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