WordPress powers 43% of the web. Most people use it for blogs, business sites, and online stores. We used it to build a collection of real-time multiplayer browser games.
The project is GoTrivia – a free platform with four games: TriviaBlitz, Scattershot, Pictionary, and multiplayer Sudoku. Each one runs in your browser, requires no account, and supports real-time multiplayer through a shared link.
Building real-time applications on WordPress is not the default use case for the platform. This post covers the architecture decisions we made, the problems we ran into, and what the whole thing taught us about pushing WordPress beyond its comfort zone.
Why WordPress for a Multiplayer Game Platform?
The honest answer is that it was the right tool for our stack. We already build and maintain custom WordPress websites for clients across a range of industries, so the ecosystem – plugins, hosting infrastructure, deployment workflows – was familiar territory.
But there was a more considered reason too. GoTrivia is not just a game. It is a content platform with SEO-driven blog posts, a growing audience, and pages that need to rank in search. WordPress handles all of that better than a custom framework would. Building a standalone Node.js or Next.js app would have given us better real-time performance out of the box but at the cost of the entire SEO and content layer that is core to the GoTrivia growth strategy.
The challenge was making WordPress do things it was never really designed for.
The Core Technical Problem: Real-Time Multiplayer on a PHP Platform
WordPress is built on PHP and runs a request-response model. A user visits a page, the server processes PHP, returns HTML, and the connection closes. That is fine for a blog post. It is a problem when you need four players in the same game room seeing each other’s answers update in real time.
Real-time multiplayer requires persistent connections. The two standard approaches are:
WebSockets – a full-duplex connection that stays open between the client and server, allowing the server to push data to the browser without the client making a new request each time.
Long polling – the client makes a request, the server holds it open until there is new data, then responds. The client immediately makes another request. It simulates real-time at a cost of overhead.
For GoTrivia’s scale – free casual games, not a competitive esports platform – we opted for a WebSocket implementation using a lightweight Node.js server running alongside WordPress, not inside it. WordPress handles page rendering, user sessions, game room URLs, and all content. The Node.js layer handles the real-time game state: player joins, answer submissions, score updates, and round progression.
The two layers communicate. WordPress issues a game session token when a room is created. The Node.js server validates that token and manages the room. From the player’s perspective, it all feels like one seamless experience.
How the WordPress Plugin Architecture Works
Each game on GoTrivia is its own WordPress plugin. That decision was deliberate. It keeps the codebase modular – a bug in Scattershot does not touch TriviaBlitz, and adding a fifth game means writing a new plugin rather than editing a shared monolith.
This is a pattern we use across a lot of our custom WordPress web design work: separate functionality into plugins rather than burying everything in a theme’s functions.php. It makes maintenance cleaner, updates safer, and handover easier.
Each game plugin does the following:
Registers a custom post type or page template for the game room. When a player creates a room, WordPress generates a URL with a unique room ID in the query string. That URL is what gets shared with other players.
Enqueues the game’s JavaScript bundle. The actual game logic – drawing canvas for Pictionary, the letter-and-category system for Scattershot, the Sudoku grid renderer – lives in JavaScript. WordPress is just the delivery mechanism.
Handles REST API endpoints for actions that do not need real-time speed. Storing final scores, retrieving question sets for TriviaBlitz, logging game sessions. These go through the WordPress REST API because they are not time-sensitive.
Manages game state initialization. The PHP plugin sets up the initial game state and passes it to the JavaScript layer via wp_localize_script, which is WordPress’s built-in way of injecting PHP variables into JavaScript.
Building the Game Logic in JavaScript
This is where most of the actual game development happened. The PHP and WordPress layer is infrastructure. The games themselves are pure JavaScript applications that run in the browser.
A few things worth noting from a technical standpoint:
TriviaBlitz uses a question pool fetched from the REST API at round start. Questions are loaded once per round rather than per question to minimize API calls. The real-time layer only handles answer submission and score broadcasting.
Scattershot’s most interesting technical challenge was the duplicate detection. Every player’s answer set needs to be compared against every other player’s in the same round, and the results need to arrive simultaneously so no one sees the comparison before everyone has submitted. We handle this by collecting all answers server-side before broadcasting the scored result to everyone at once. The Node.js layer acts as a gate – it waits until all players have submitted or the timer expires, then triggers the comparison and pushes results.
Pictionary’s drawing canvas is built on HTML5 Canvas. The drawing data is transmitted over WebSocket as coordinate deltas rather than full canvas state – sending the full canvas image on every stroke would be bandwidth-prohibitive. The receiving clients reconstruct the drawing incrementally from the coordinate stream.
Multiplayer Sudoku tracks each player’s grid state independently but broadcasts progress updates (percentage complete, not the actual answers) to all players in real time for the leaderboard. Full grid state only syncs when the round ends.
WordPress Performance Considerations for Interactive Applications
Running a real-time application inside a WordPress deployment means being deliberate about what WordPress handles and what it does not. A few things we learned:
Aggressive caching is your enemy on game pages. WordPress caching plugins like WP Rocket or W3 Total Cache are excellent for standard pages but should be excluded from game room URLs. A cached game room page will serve stale state to players. We use URL pattern exclusions in the caching config to bypass cache entirely for room URLs.
The WordPress REST API has authentication overhead. For actions that fire repeatedly during a game – like fetching mid-round updates – we bypass WordPress authentication and handle it through the Node.js layer instead. WordPress auth is only invoked for operations that write persistent data.
Database queries on every WebSocket message would kill performance. We use in-memory state on the Node.js server for active game sessions. Only when a game ends does the final state get written to the WordPress database. This keeps the database clean and query counts low during active play.
If you work with WordPress regularly and want to go deeper on performance patterns, the WordPress training we offer covers a lot of the fundamentals that underpin decisions like these.
The SEO Layer: Why WordPress Earns Its Place
The real-time infrastructure could have lived on its own without WordPress. What WordPress gives GoTrivia is everything around the games.
The GoTrivia blog is built on WordPress and targets keywords like free browser games to play with friends, virtual game night ideas, and free Jackbox alternatives. These posts drive organic traffic that converts into game players. Without WordPress handling that content layer efficiently, GoTrivia would need a separate content system running alongside the game platform, which adds cost and complexity.
This is the same argument we make to clients who ask whether they need WordPress or a more custom solution. For most businesses, the answer is WordPress – not because it does everything perfectly, but because it handles content, SEO, and site management well enough that the overhead of a custom framework is rarely justified. Our lead generation SEO service is built around exactly this kind of WordPress-as-content-engine thinking.
What We Would Do Differently
A few things we would reconsider if starting from scratch:
We would evaluate WebSocket hosting earlier. Finding a hosting provider that handles persistent WebSocket connections cleanly, plays well with WordPress, and does not require a dedicated server took longer than it should have. This is a narrower requirement than standard WordPress hosting and the options are fewer.
We would build the scoring system as a standalone service from the start. We started with scoring logic split between PHP and JavaScript and consolidated it to the Node.js layer after realising the split was creating inconsistencies. Centralising state management in one layer earlier would have saved refactoring time.
We would invest in a proper local development environment for the real-time layer sooner. Testing WebSocket behaviour locally while also running WordPress adds friction. Tools like ngrok for tunneling and Docker for containerising the full stack make this much smoother. We got there eventually but not immediately.
What This Project Proves About WordPress
GoTrivia started as a question: can WordPress support something that is fundamentally not a content site? The answer is yes, with the right architecture. WordPress handles what it is good at – content delivery, SEO, plugin-based modularity, a familiar admin interface – and the real-time application layer handles what PHP cannot.
The lesson is not specific to game development. It applies to any project where a client has an interactive application idea but also needs a blog, marketing pages, and SEO. Keeping WordPress in the stack for the content layer while extending it with a lightweight real-time service is a pattern that works.
If you are a developer or agency considering something similar, the full game suite is live at GoTrivia. All four games – TriviaBlitz, Scattershot, Pictionary, and multiplayer Sudoku – are free to play in any browser. Have a look at how they perform on mobile, on slow connections, and with multiple players, and you will get a sense of what the architecture above produces in practice.
If you are thinking about building something custom on WordPress and want to talk through the approach, the Qodewire team is always happy to dig into a brief.









