PHP is alive and well in WordPress

Dylan Crawshaw
2 min readJan 15, 2021

How PHP is used in WordPress and why it is here to stay.

PHP or PHP: Hypertext Preprocessor is a programming language used to make dynamic and interactive web pages. As so, WordPress is written in the scripting language and both are open source.

PHP is a completely server-side language. That meaning when a site’s user makes a request to a page that has PHP code, the PHP code is then processed by a PHP module installed on the server. It then dynamically generates HTML that can be displayed on the user's screen (the browser).

Below is a simple example of PHP doing what every programming language does best…

<?phpecho "Hello, World!";?>

All PHP files have a .php extension and this is no different when they are inside a WordPress powered application. The cool thing about WordPress is that most users don’t need to learn PHP to create a dynamic web page. However, in order to develop WordPress themes, plugins, or change the default actions knowledge of PHP, HTML, and CSS is necessary.

One of the first PHP files you might change in a WordPress application is functions.php. It is located in your theme folder. Like a plugin, the functions.php file uses PHP in order to add or change features. An example of this is writing code to add a new widget area to the page, or even something simple as a new welcome message to the WordPress dashboard.

This might sound exciting, but adding code snippets to the functions.php is usually not a good idea. WordPress tries to separate functionality from design. Themes are used for design while plugins are used for functionality. This way changing your theme shouldn’t take away any features from your site. One way around this is to create a child theme.

A solution to this is creating your own plugin. One easy way to add code snippets without worry is the Code Snippets plugin. It makes managing your custom code easy and safe. The interface is easy to use and even features a full code editor.

--

--