WordPress and PHP are not the same type of thing, so comparing them directly is a bit like comparing a car to an engine — one is built on top of the other. PHP is a programming language. WordPress is a content management system (CMS) written in PHP. WordPress runs on PHP; they are not alternatives to each other.
The comparison most people actually mean when they ask this question is: should I build my site with WordPress, or build it from scratch in PHP? That’s a meaningful choice, and the right answer depends on what you’re building. This guide covers both questions.
What is PHP?
PHP (PHP: Hypertext Preprocessor) is a server-side scripting language created in 1994. Unlike HTML and CSS, which run in the browser, PHP runs on the web server before the page is sent to the user. The server processes the PHP code, generates an HTML document, and sends that HTML to the browser. The user never sees PHP — only the output.
PHP connects to databases (typically MySQL or MariaDB), handles form submissions, manages sessions and authentication, sends emails, reads and writes files, and generates dynamic content — anything that needs server-side logic. A PHP application is built from scratch: the developer writes every route, every database query, every template, and every piece of business logic.
PHP powers a large proportion of the web. WordPress itself is written in PHP. So is Wikipedia’s backend (MediaWiki). Laravel and Symfony — two of the most popular modern web frameworks — are PHP frameworks. Knowing PHP doesn’t lock you into WordPress; it opens doors to building any kind of web application.
What is WordPress?
WordPress is an open-source CMS built in PHP (and JavaScript). It was released in 2003 and now powers roughly 43% of all websites on the internet. WordPress provides a complete system for managing website content without writing code: an admin dashboard, a page and post editor, a media library, user management, theme switching, and a plugin system that extends functionality.
Under the hood, WordPress is PHP. Its templates are PHP files. Its plugins are PHP classes and functions. Its core functions — get_the_title(), WP_Query, wp_enqueue_script() — are all PHP. When you install WordPress on a server, you’re installing a PHP application. The difference is that this PHP application has already been written for you, so you don’t have to build the CMS from scratch.
For a deeper introduction to what WordPress is and how it works, see the beginner’s guide to WordPress.
How WordPress Uses PHP
Every WordPress theme is a collection of PHP template files. When a visitor loads a page, WordPress runs PHP code that:
- Determines which template to load (single post, page, archive, home, 404, etc.) based on the template hierarchy
- Queries the MySQL database for the relevant post or posts
- Loads the template file and runs its PHP code
- Calls PHP template tag functions (
the_title(),the_content(),get_the_permalink()) that output the data from the database - Runs all registered WordPress hooks and filters
- Sends the final HTML to the browser
If you’ve customised a WordPress site by editing functions.php or creating a child theme, you’ve written PHP. If you’ve built a custom plugin, you’ve written PHP. WordPress development is PHP development — just within the WordPress framework rather than from a blank file.
For a practical example of how PHP template functions work inside a WordPress theme, see how to get the post title in WordPress templates.
WordPress vs. a Custom PHP Website: The Real Comparison
The practical question most people are asking is whether to build their site with WordPress or to build a custom web application from scratch in PHP (or using a PHP framework like Laravel). Here’s how to think through that choice.
Choose WordPress when:
- Non-technical people need to manage content. WordPress’s admin panel lets editors publish pages, posts, images, and products without touching code. A custom PHP app would need a custom admin interface built specifically for that purpose — significant extra development time.
- You need common functionality quickly. Contact forms, image galleries, eCommerce, SEO, membership, event calendars, booking systems — there are well-maintained plugins for all of these. Building any of them from scratch in custom PHP takes weeks or months.
- The site is content-driven. Blogs, business websites, portfolio sites, news sites, and most marketing sites are well-served by WordPress’s page/post model, category/tag taxonomy, and media library.
- You want a large talent pool. Finding a WordPress developer is easier and cheaper than finding a specialist in a custom PHP framework. Documentation and community support are extensive.
- You need a fast launch. A WordPress site with a quality theme can go from zero to live in days. A custom PHP application takes months to build the equivalent infrastructure.
Choose custom PHP (or a PHP framework) when:
- Your data model doesn’t fit pages and posts. WordPress’s built-in data structure (posts, post meta, taxonomies) is flexible but not unlimited. An application with complex relational data — inventory management, multi-tenant SaaS, real-time bidding — usually needs a schema designed from scratch.
- Performance is a primary constraint. WordPress loads a significant amount of PHP on every request (even with caching). A lean custom PHP application can process requests with far less overhead. This rarely matters for content sites but matters for high-throughput APIs and applications.
- You need tight control over security boundaries. WordPress’s plugin ecosystem is powerful but introduces third-party code at every update. A custom application’s attack surface is limited to what you built — no plugin vulnerabilities, no WP-specific exploits.
- The application has complex, unique business logic. If your application’s core value is in its logic (not its content), WordPress is a constraint rather than a foundation. Custom PHP or a framework like Laravel gives you full control.
PHP Inside WordPress: The Best of Both
These aren’t mutually exclusive choices. WordPress is extensible with custom PHP at every level:
- Custom post types — register your own content types (properties, events, products) with
register_post_type() - Custom fields — store arbitrary data per post with
add_post_meta()or ACF (Advanced Custom Fields) - Custom REST API endpoints — expose data to a JavaScript frontend or mobile app with
register_rest_route() - Custom queries — query the database with
WP_Queryor raw SQL via$wpdb - Custom plugins — encapsulate any server-side logic in a plugin that lives outside the theme
Many production WordPress sites run custom PHP in plugins and theme files that handles business logic as sophisticated as anything in a custom application — they’re just built on WordPress’s scaffolding rather than from scratch. For a full picture of the trade-offs between page builders, custom code, and custom PHP, see page builders vs. custom code in WordPress.
PHP Version and WordPress
WordPress runs on PHP, so the PHP version on your server determines what WordPress features are available and how fast it runs. Each major PHP release brings performance improvements and new language features. WordPress.org recommends PHP 8.0 or higher — PHP 8.2 and 8.3 are significantly faster than PHP 7.4 for WordPress workloads.
If you’re managing your own server (a VPS or dedicated host), you can upgrade PHP yourself. For instructions on doing this on Ubuntu, see how to upgrade the PHP version on Ubuntu. On managed WordPress hosting (WP Engine, Kinsta, SiteGround), PHP version is managed in the hosting dashboard — no command-line access needed.
Do You Need to Know PHP to Use WordPress?
No. WordPress was explicitly designed so that non-developers can use it without writing any code. Most WordPress sites are built and managed entirely through the admin interface — the block editor, Customizer, plugin settings panels, and page builder interfaces. No PHP required.
But if you want to:
- Customise a theme beyond what the settings panel allows
- Build a custom plugin
- Create a custom page template with specialised layout or data
- Hook into WordPress actions and filters to modify behaviour
- Query the database for data that isn’t available through a plugin
…then PHP is the skill you need. WordPress development uses PHP for all server-side logic. Learning PHP unlocks every layer of WordPress customisation. For a sense of whether WordPress itself is hard to learn before you get to the code side, see whether WordPress is hard to use.
Summary: WordPress vs. PHP
| PHP | WordPress | |
|---|---|---|
| What it is | Programming language | CMS application |
| Written in | C | PHP + JavaScript |
| Who uses it | Backend developers | Site owners, developers, designers |
| Code required | Yes — you write all the logic | No — for basic use; PHP for customisation |
| Admin panel | Build your own or none | Built-in |
| Plugin ecosystem | None (use Composer packages) | 60,000+ plugins |
| Best for | Custom web applications | Content-driven websites |
| Time to launch | Months | Days to weeks |
Before committing to WordPress for a new project, reviewing five things to know before making a WordPress site helps set realistic expectations about what it does well and where custom development is still needed.


