iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up

Intro

WordPress powers a huge chunk of the web. Open-source PHP CMS, theme + plugin architecture, REST + GraphQL APIs, and a vast ecosystem.

WordPress — what it is

EXAMPLE
<?php
// ===== The model =====
// Core: PHP CMS with database (MySQL/MariaDB)
// Themes: presentation (templates, styles, blocks)
// Plugins: functionality (forms, SEO, e-commerce, anything)
// Block editor (Gutenberg): React-based editor; content is block JSON
// REST API: /wp-json/wp/v2/...
// CLI: wp-cli (the under-loved superpower)

// ===== Installs =====
// 1. wordpress.org (self-hosted, full control, BYO hosting)
// 2. wordpress.com (managed SaaS; tiered plans)
// 3. Local dev: LocalWP, Docker, MAMP, XAMPP, Lando

// ===== A minimal plugin =====
/*
Plugin Name: Hello Box
Description: Adds a notice to the dashboard.
Version: 0.1.0
Author: You
*/
add_action('admin_notices', function () {
    echo '<div class="notice notice-info"><p>Hello from the plugin.</p></div>';
});

// ===== Hooks: actions + filters =====
add_action('init', function () {
    register_post_type('book', [
        'label' => 'Books',
        'public' => true,
        'show_in_rest' => true,
        'supports' => ['title', 'editor', 'thumbnail'],
    ]);
});

add_filter('the_content', function ($content) {
    return $content . '<p><em>Read more on our blog.</em></p>';
});

// ===== Headless WordPress =====
// Use WP as a content backend; consume via REST or WPGraphQL from a Next/Nuxt/Astro front.
// Decoupled = fast frontend; WP for editor experience.

// ===== When WordPress wins =====
// - Marketing sites + blogs you want non-engineers to edit
// - E-commerce (WooCommerce)
// - Membership / community sites with mature plugins
// - SEO-heavy publications
// - When 'I need a CMS that everyone has heard of'

// ===== When WordPress hurts =====
// - Highly custom apps where the CMS frame is a constraint
// - Very high traffic without serious caching
// - Strict compliance regimes (still possible, requires hardening)

// ===== Patterns to internalise =====
// - Themes for presentation only; plugins for behaviour
// - Child themes when modifying a parent theme
// - WP-CLI for everything repeatable (deploys, migrations, backups)
// - Pin plugin versions; review changelogs before updating

// ===== Pitfalls =====
// - Editing core or theme files directly (loss on update)
// - Plugin proliferation -> compatibility hell + perf collapse
// - No automatic backups -> the day to test backups is BEFORE the incident
// - Public 'wp-admin' over HTTP -> never; HTTPS + strong auth + 2FA

Why it matters

WordPress is a content platform with a vast ecosystem and a clear hook-based extension model. Themes for presentation, plugins for behaviour, WP-CLI for ops. Reach for it when editors need a familiar tool and the content lifecycle (drafts, schedules, media) actually matters.

Tip: Tweak the snippet with Try it Yourself », then sit the quiz at the bottom of the page.

Example

Example
// WordPress is open-source PHP + MySQL.
// Themes shape the look. Plugins add features.
Try it Yourself »

Exercise

Self-hosted WordPress lives at…

.org

Test yourself

Q1. WordPress is written primarily in…
Q2. Self-hosted WordPress lives at…
Q3. Roughly what share of the web does WordPress power?

Discussion

Loading…