WordPress has evolved a lot since its beginnings. Apart from being a simple blog CMS, you can use it for other purposes — enterprise solutions for banks and large news portals, eCommerce solutions, web apps, etc.
the PHP written in it is done using object oriented PHP. That means that we are taking care of the code architecture. We want to write clean code. That is why we are using dependency injection container (DIC) to manage dependencies. Autowiring classes in the DIC and autoloading them using Composer. We emphasize in writing a code that can be tested using automated tests.
Be careful not to pack too many custom functionalities in your theme. All custom functionalities should be placed in a plugin.
Front end and back end
The back-end part (admin interface) is written in PHP. When writing various functionalities, use WordPress core functions whenever possible. They are created to work specifically with WordPress core, and will make your code not only more future-proof but also safer.
Front end can be built with traditional PHP templates. We can also use the REST API that has been included in the WordPress core since version 4.4, and use modern frameworks such as React, Vue, or Angular to build our web apps (decoupled approach).
We've added a
wp-config-project.php file that has environment-specific constant definitions. Some of those are used for debugging your code.
This is especially useful when you want to watch for any asynchronous calls, such as
If you want to, you can install Xdebug - a debugger and profiler tool for PHP. It is really useful because you get better-looking error messages, profiling and breakpoints in your PHP code.