Most of WP core is written in PHP which is why it’s natural for WordPressers to want to at least know what PHP is. Gather around, guys, we’ll tell you.
What’s PHP anyway?
Basically, PHP is the open source programming language in which WordPress is written.
According to W3Techs, PHP is used by over 83% of all websites using server side language over the internet. Wikipedia says PHP is “a server-side scripting language designed for web development.”
Let’s break down the definition.
Server-side just means that the visitors of your site never see the PHP code that runs your WP website: it is executed/processed on your server. The visitors just see the end result in HTML.
What’s your site’s PHP code? WordPress itself with a bunch of other classes, functions, methods, and hooks, along with any installed themes or plugins.
PHP 5 or PHP 7?
You can use different versions of PHP. 10Web supports PHP 5.6, 7, 7.1, and 7.2 since although PHP 7 is really fast and more secure, a lot of sites still run the 5.6 version. You can pick your PHP version from 10Web dash with a single click:
That being said, 5.6 is actively nearing its end and will soon stop receiving security support. Our advice here is to use at least 7.
PHP use in WordPress
People learn better if they see things for themselves so download a WordPress copy from WordPress.org, and open the ZIP file:
As you see, most files are PHP. In the same vein, if you download a theme it will be mostly made up of PHP files:
Each file corresponds to its logical function:
comments.php controls the look and functions of the comment section;
404.php controls the look/functions of the Not Found page;
archive.php is responsible for the archive;
Whenever your site gets a visitor, your web server takes these PHP files responsible for various parts of your site, puts them together as your theme dictates, and delivers the complete HTML output to said visitor’s browser.
Plugins work in a similar manner!
So, do you have to know PHP?
Probably not. Sure, if you want to create your own plugins or themes or tweak an existing plugin a certain way, you may need to learn some PHP but most of the WordPress users do perfectly fine without it.
Most tools and features you need are already there, waiting for you to choose them, download, and use.
There’s no harm in knowing the basics of PHP though. Even if it’s just to understand how your site is powered.
Have any PHP-related questions? We most likely have the answers. All you have to do is write them in the comments.