WordPress Logo

WordPress Scripting: Server-Side and Client-Side

The term “coding” is broad and refers to any machine language that writes instructions for a computer or computer program. Scripting is a specific type of coding that sends instructions to websites or programs running on a computer. These instructions can be either on the client-side (the front-end) or the server-side (the back-end). When you visit a WordPress website it will first request that page from a server. The server will run any server-side scripts and then send the page to my browser along with the code necessary for the client-side scripting. Client-side and server-side code are the building blocks of WordPress scripting.

Let’s go into some more detail about exactly what server-side and client-side scripting is. In addition, we’ll discuss specifics about how this all relates to WordPress. By the end, you should have a better understanding of how server-side and client-side WordPress scripting works.


What Is Server-Side Scripting?

The server is the location where the files for your website are stored. When someone loads your site, their browser sends a request to the server. The server-side script then processes the request and sends the results back to the user. This back-and-forth, with the server processing code and information from a storage mechanism such as a database, is the core of server-side scripting.

In short, server-side scripts run on the server hosting the site in the few seconds between someone clicking something on your site and the content appearing in their browser.

What Is Server-Side Scripting Used For?

In most cases, server-side scripting is used for most aspects of loading a web page. It’s the building block of websites. For example, say you are visiting your favorite WordPress-powered website. When you first visit, the browser you’re on sends a request back to the server with information about what post you are viewing. Server-side scripts then instruct the server to pull that post’s data and construct the HTML for the page. Then the server sends that markup to your browser.

If you have a site with a personalized login page for your clients, the same thing will happen. The server needs to send their personal details back to the browser after they log in. You may see different content on the login page depending on if you are logged in or not. That’s server-side scripting. It decides what to display based on variables and conditions.

Which Parts of WordPress Scripting Are Server-Side?

The core of WordPress, and most third-party plugins, are all powered by server-side scripting. WordPress is built on top of PHP which is a server-side programming language. Data is stored inside of a MySQL database. These two components, when combined, handle all of the server-side processing requests a WordPress site makes. High-quality hosting is important because so much of WordPress works on a server. This is why you see so many ads for expensive WordPress web hosting nowadays. In addition, you can offset the slowness of server-side scripting with one of the many popular WordPress caching plugins.


What Is Client-Side Scripting?

In simple terms, client-side scripting is code that makes changes to the page in the browser where it is being unpacked. This happens on the user’s end and so it depends on their computer, rather than a server. With client-side scripting, the code is sent to and temporarily stored in the browser of the person viewing it.

Client-side scripts, such as JavaScript, work by interacting with a page’s HTML code to add or change what is shown on the page under different conditions.

What Is Client-Side Scripting Used For?

Client-side scripting is used to make websites more interactive. Think pop-up boxes and other exciting visual changes in the browser. Client-side scripting runs on the browser (such as Chrome or Firefox) that the page is being loaded on.

Design elements that display and become interactive without needing the page to reload are generally using client-side scripts. An example would be clicking on a photo in your social media feed and it becomes larger. This works because the photo has already been sent to you by the server and stored temporarily in your browser. The client-side script then makes it interactive by pulling the information from the HTML file and altering the image size.

Which Parts of WordPress Scripting Are Client-Side?

At its core, most parts of WordPress are server-side as we discussed. You’ll most often see client-side scripting on a WordPress site through themes and plugins. For example, any WordPress site that has one of those infinite scrolling lists of posts is using client-side scripting. Many plugins with interactive front-end elements, like a WordPress popup plugin, are using come client-side scripting as well. For the majority of instances, WordPress client-side scripting is going to involve something visitor-facing and interactive.


WordPress Scripting Is Server-Side and Client-Side

Server-side scripting prepares WordPress content before it’s sent to the browser. This usually happens before the page is loaded. Client-side scripting is used to make sites more interactive. Most WordPress sites now rely on both client-side and server-side scripts to give a complete experience. A site’s files are sitting on a server waiting for someone to request to view them. When the server receives a request, it sends those site files along with any client-side scripts to the visitor’s browser. The client-side script is used to make the page more interactive.


Related Posts from Our WordPress Blog

3 Reasons Why You Should Use a Content Management System

Check out our three reasons why you should use a content management system in your freelancing or agency business.

How to Create a WordPress Dropbox Backup Every Day for Free

Set up a schedule to automatically create a WordPress Dropbox backup. We will show you how to using the BackWPup plugin.