JavaScript and PHP Libraries Used by WordPress

By Aleksander Koko
We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now

Almost all modern software (including platforms such as WordPress) rely on third party libraries. That’s because, as developers, we don’t need to reinvent the wheel.

If I had to develop software that uses HTTP abstraction, I might use a package like Symfony HttpKernel or similar. If my software needed more than that (unlikely by the way, but let’s imagine that for our example), I could extend that package, or in the worst case, create one from scratch. Creating something from scratch isn’t a bad thing. It can actually be a good thing, since it makes you a better developer. But commonly, in most modern projects, you’ll have to depend on third party libraries (or packages). In this article we’ll take a look at the various third party JavaScript and PHP libraries used by WordPress.

List of Used Libraries in WordPress

In WordPress, third party libraries live alongside WordPress files. To better understand how files are structured in WordPress, the WordPress Codebase page will give you some answers. The wp-includes folder holds some of the libraries that are included when the application is executed. Also, in wp-admin you’ll find a second include folder that does the same as the first. In both folders you will find PHP and JavaScript files.

The third party PHP libraries are named with class-*.php (single files) or live inside their own folder. Other PHP files named class-*.php can be WordPress files (not third party). PHP files live under the wp-include or wp-admin/include folders.

JavaScript files also reside under these folders, but they are grouped in the js folder.

The CSS files are mainly jQuery or TinyMCE CSS files, found under CSS folder in the include folders.

JavaScript Libraries

Let’s start with the JavaScript libraries. WordPress uses jQuery heavily. It uses:

As you might notice, some of these libraries don’t have a link. That’s because some are them are very old and the repos don’t exist anymore. Let’s check them out one-by-one.

jQuery is a famous library, one that doesn’t need an introduction.

jQuery Masonry is plugin that makes easier to create masonry layouts like this one:

jQuery Masonry plugin

Layouts like this are a bit hard to do from scratch, jQuery Masonry makes this easy.

jQuery Hotkeys deals with shortcuts on the browser. If you’re used to tools such as StackEdit.io, you may use ‘ctrl+s’ (command+s) to save a file on gDrive or other cloud providers. The (ctrl+s) shortcut by default in your browser can be used to save a web page, using this plugin you can override these default shortcuts.

jQuery Form deals with forms and AJAX calls. If you’re curious and want to learn more about this plugin, you can check out their docs.

jQuery Color is used by WordPress for color manipulation and animation.

jQuery("#go").click(function(){
    jQuery("#block").animate({
            backgroundColor: "#abcdef"
    }, 1500 );
});

The first line selects the element with id="go" and tells the browser that it should animate the background color of the element with id="block" in 1.5 seconds.

jQuery Migrate helps you when dealing with earlier jQuery codebases. This is very important for WordPress because it is a platform that should be backwards compatible.

As a matter of fact, backwards compatibility is one of the most well known features of WordPress. On the other hand, it’s one of the problems with WordPress. WordPress was released in 2003, the PHP version that was used for that release is ancient. Today, PHP is a modern language and has borrowed many useful features from other languages. But this is another topic, one for a future article.

WordPress also uses other JavaScript libraries, not just jQuery. Here are some other popular libraries it uses:

And the list goes on and on.

The most famous from this list is TinyMCE and Backbone. TineMCE is used to compose new Posts and Pages in the WordPress dashboard.

Backbone is a front-end framework, in fact it was one of the first. It is still being used today, but loosing a lot of market share from Angular and other front-end frameworks. And yes, I’m talking to you Meteor. But don’t worry, in the JavaScript universe, frameworks (libraries) are forgotten as fast as they become popular.

PHP Libraries

The list of PHP libraries is a bit different. We saw that JavaScript was mainly influenced by jQuery and some other popular libraries. With PHP, things are different, as most of the third party libraries are just one class (file). Here’s a short list of the current third party PHP libraries:

An Open Discussion

Many of the libraries are a bit outdated. This is when discussions on topics such as architecture tend to happen. I would personally like to see Bower and Composer integration with WordPress. I would like to ask the SitePoint community about these ideas, and have an open discussion on how things can be improved with WordPress. Please leave your comments and thoughts below.

Conclusion

In this article we’ve seen the various third party libraries that WordPress uses. Knowing what WordPress uses behind the scenes, you’ll have a much better understanding on how it works. The better your understanding, the faster and smarter you’ll be able to work with WordPress. Maybe you can even work towards contributing to WordPress core. After all, this is the world of Open Source, we learn from each other and share ideas (both code and pizza!).

We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now
  • veer singh

    As we know that PHP is a server side scripting which designed for web
    developers and also for simple purpose programming language. PHP courses
    are provided by many best
    PHP training institutes in Jaipur
    and they provides all types
    of accommodations.

  • Alejandro

    WordPress is very old and the conventions in code and API are awful.
    Nowadays I’m using October because it’s pretty clean and have a great documentation, also uses composer and Laravel.
    It’s not as easy extendable as WordPress from the user view, but for now the users that I gave a WordPress account always needed a developer help to get the stuff working as they expected.
    So I think PHP needs a modern and better CMS if you see how many sites are running WordPress right now.

    • Aleksander Koko

      Hi @disqus_D0vONvVUce:disqus . How October looks like? I always wanted to try it but haven’t tried it yet. I use WordPress when I have too. Mostly user of Laravel Framework.

      • Alejandro

        Well October is based on a real plugin system, those components are independent and based on Laravel Framework. October also uses Yaml and Twig to allow you create usable forms on the CMS.
        The three things that I like the most:

        1. The structure is well defined so you can create site themes, plugins and all the stuff you need completely independent without touching the Laravel core behind the scenes. This is because the arquitecture is very different than the WordPress arquitecture.

        2. The framework and the community are using PSR coding conventions and Jquery on the frontend but again all the stuff is presented to you with a set of utilities to use.

        3. The UI is really simple so this is very useful for unexperienced users. I made an experiment with friends and all them preferred the October’s admin interface over the WordPress interface.

        What I don’t like:

        Like they say, October is not completely a real CMS because you have to write the components you want to use and touch the code, so if you’re not a programmer maybe using October is not the best option.
        But I think this can be solved as the community and the quality of the plugins available grows.

        And at the end the people that want to maintain a website or blog always gonna prefer a scalable and maintanable code, other way they just should be using a free option like blogger, wix etc.

        So in conclusion if you like the Laravel’s way October could be a good option.

        • Aleksander Koko

          I have seen it just a bit before 2 weeks and didn’t like it. Maybe I haven’t seen it in real project but will give it a try.

  • Aleksander Koko

    Also check https://learnable.com/books/php-master-write-cutting-edge-code (PHP Master write cutting edge code) on Learnable. It’s one of the best PHP ebooks out there.

  • M S i N Lund

    I just started 7 weeks ago and I’ve gotten 2 check for a total of
    $2,000…this is the best decision I made in a long time!. And if you
    want to know how i did it, you can just go suck an egg! All for me, all
    for me!! Ahhahahahaaa…

  • Great article. Any plans to do one for Joomla?

    • Aleksander Koko

      I don’t know Joomla very well. Not planing to do one. But If I do one, will let you know here in the comments :)

  • CTN

    PHPmailer is horrible. switch to swiftmailer!