We teamed up with SiteGround
To bring you up to 65% off web hosting, plus free access to the entire SitePoint Premium library (worth $99). Get SiteGround + SitePoint Premium Now

WordPress is one of the most popular CMS (Content Management Systems) as far as the user base and ease of access is concerned. Many famous content rich websites use WordPress as their back-end – including SitePoint itself. Regular updates, a larger community, great support forum, rich documentation and many other factors have put WP way ahead of its competitors.

The first thing that comes to most people’s minds when thinking of WordPress is Blog or Content Management Platform, but there is another angle to it. Have you considered that it can act as a full framework for developing web applications as well?

There are various aspects which are taken into consideration before choosing a framework for web development. In this piece, we are going to look into features that WP provides if we treat it as a web development framework.

Community, Support and Documentation

WordPress has a great community and an active support forum. Whether it is an issue with installation, setting up, development or anything else, everything is timely resolved by the support community. The WordPress Codex is a community moderated wiki which is regularly updated. Documentation is the first thing you need when learning any new language or framework, and the codex provides just that. While most, if not all, other frameworks also sport these features, it’s important to note that WP does too, thus not lagging behind.

User Management

WordPress has an excellent user management module which takes care of all the functionality such as user registration and login, user role management, assigning capabilities to different roles and creating new roles. This functionality can be further enhanced by using plugins like the Capability Manager which also provides all the above features without you having to worry about session management or security issues.

If we talk about other frameworks, most provide some sort of User Management solution – for example, Yii provides a user management extension known as Yii-User and similarly for CodeIgniter framework, you`ll find a user management control panel named BackendPro which you can easily integrate into your CI project.

Admin Dashboard

Who wouldn’t love their application having an easy to use admin panel through which the front-end content could be managed? WP provides a ready to use back-end panel which has most of the options you might need. In addition to it, you can create your own custom setting pages for a wide set of requirements. One more perk is that you don`t have to worry about back-end styling at all – WP comes with its own set of styles for the back-end panel.

The Admin Dashboard is the part that lacks in other frameworks. Symfony and Yii provide a couple of extensions for their respective frameworks through which you can generate the Admin UI, but the functionality part is left up to you. This is one area in which having a CMS is advantageous, but can cause significant overhead if it lacks the features you need, and has features you don’t.

CRUD (Create Read Update Delete) Operation

Most people appreciate a framework’s help in performing these basic operations, so picking one that makes it easy is often a deciding factor for many developers.

Lets try to relate this with the real world a bit. As far as WordPress is concerned, everything is a post. A book is a post, a person is a post, and any distinguishable entity is a post. WordPress calls them Custom Post Types.

Let us take an example of Book for now. If you tell WordPress that you want to define a post type named “Book” for your application, you will automatically get all the CRUD bundled with it.

  • Add / Update Book – This will be the default WordPress post edit screen for adding / updating books.
  • View / Delete Books – This will be the book listing page with delete option as well.
    add_action( 'init', 'create_post_type' );
    function create_post_type() {
            register_post_type( 'book',
            array(
              'labels' => array(
                 'name' => __( 'Books' ),
                 'singular_name' => __( 'Book' )
              ),
            'public' => true,
            'has_archive' => true,
            )
        );
    }

The above code snippet does all the magic behind it, and the CRUD operation is generated for the book post type. You do not have to write SQL queries for this, rather focusing on the business logic, making the development truly rapid.

Considering other frameworks, Yii dominates with its very easy to use GUI CRUD Generator followed by the GroceryCrud module for CodeIgniter and then scaffolding in CakePHP. True, the nitty gritty fine tuning of CRUD operations and database relations is still up to you, but when wanting to get off the ground fast and improve later, these solutions come second to none.

Uploads and Media Management

File upload and media management is a must for all modern day frameworks as you cannot think of any application which does not have media support these days – whether it is images, music or videos. WordPress has an integrated media library (these media files are nothing but attachment post types as we have discussed above) through which you can upload media and perform various operations such as cropping, flipping, resizing etc.

WordPress image functions allow users to use the uploaded images anywhere in the front-end with all the modification flexibility from your side. You can even create a gallery of images in the back-end and display it in the front-end.

If we look outside WordPress, Symfony and Yii also provide cool extensions for media and file upload management, but objectively, none as rich as a fully formed CMS like WordPress. This takes a huge chunk of manual development of your time, allowing you to focus on the business critical parts first.

Extensibility and scalability

From a developer’s point of view, extensibility and scalability are a very important part of every framework. Hooks and Filters are what make WordPress a powerful framework for development.

Filters

If you want to change the output of some default functionality, just pass it to your custom filter and output anything you want.
Suppose you are managing a directory website (with lists of all types of books) with their respective prices, and you want to increase the appeared price of every book by $10. This will be the filter you`ll write.

    add_filter('book_price','custom_book_price');
    function custom_book_price($book_price){
        $book_price = $book_price + 10;
        return $book_price;
    }

The above code will add $10 to the price of each book and will show in the view. Filters are present in every high quality modern framework and templating engine.

Hooks

Hooks are nothing but custom function calls at specific points in the WordPress code execution chain. You can even think of them as triggers. Suppose you want to be notified via email whenever a new entry is created in your application. For this you will hook a custom function up to the default publish_post hook of WordPress.

add_action('publish_post','custom_mail_admin');

Now all you need to do is implement the function custom_mail_admin and it will get executed automatically whenever a new post is published.

Hooks and Filters together are a powerful duo, and one of the main reasons of WordPress’ successful evolution into a web development framework for so many companies.

To a certain degree, hooks are supported in all major frameworks, but vary in trigger times. Obviously, a framework like, for example, Kohana won’t have a “publish_post” hook, but might have a “post-controller” hook (it does – in the form of system.post-controller) which executes after a controller is finished performing its action.

URL Routing and SEO Friendly URLs

A very important parameter if you are looking towards building a news/content application or website. The URL structure plays a very important role in SEO as we all know, and WordPress has a powerful Permalink functionality through which you can have different types of permalinks for content or pages depending on your requirements.

URL rewriting also plays a crucial role in a complex web application where your URL contains many GET parameters and the URL becomes too long and complex. Like many frameworks, WordPress provides a Rewrite API through which you can play with the URL structure and customize it as per your requirements, though admittedly, WP does this in an incredibly user friendly manner.

Almost all frameworks support URL routing, among which Laravel provides a decent user-friendly routing API followed by Yii, Zend, CakePHP and others.

Caching

If you are looking at a high performance application serving millions of users, you need to have a caching mechanism in place. WordPress has a built in Transient API which provides database level caching functionality to be used in your application. If you are looking for a more advanced caching mechanism with all the controls in your hand, then plugins like W3 Total Cache will serve this purpose. Use this way to manage cache without much overhead.

Again, most frameworks support this. Some examples include Yii and Laravel, both of which provide a very easy caching mechanism, arguably better than WordPress’, through which you can boost you application’s performance.

Templates

WordPress Templates deal with presenting your content. If you are familiar with the MVC architecture, you can relate templates to views. One page can be assigned multiple templates. So even if data is same, the styling will vary.

Considering other frameworks, Laravel and Phalcon have amazing templating engines built in, while other frameworks have their own solutions as well.

What about MVC ?

These were all the major features that make WordPress a complete web application development framework if we compare it to the other frameworks on the market, but what about MVC? Almost every web framework nowadays follows the MVC architecture. Indeed, WordPress does not follow this architecture due to dedicated support for backwards compatibility with older deployments. In spite of this, efforts are being made to make WP follow the MVC pattern – you can check out WP MVC and Tina MVC.

Conclusion

WordPress is by no means a drop-in replacement for other frameworks, but makes for a decent alternative, providing most, if not all features covered by already popular frameworks. One thing to be worried about is its performance and overhead due to functions you may not exactly be needing for your particular app, but as far as developing functionality in it goes – WordPress can indeed rival some of the best frameworks out there, even if it is “just” a CMS.

Hope you enjoyed reading the article. Comments are welcome!

We teamed up with SiteGround
To bring you up to 65% off web hosting, plus free access to the entire SitePoint Premium library (worth $99). Get SiteGround + SitePoint Premium Now